Advertisement
fauzanjeg

Prevent Current Post from Module

Nov 22nd, 2021
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. /* Prevent Current Post from Module */
  2. function prevent_current_post_from_module( $args ) {
  3.     if ( is_array($args['post__not_in']) ) {
  4.         array_push( $args['post__not_in'], get_the_ID() );
  5.     } else {
  6.         $args['post__not_in'] = (array) get_the_ID();
  7.     }
  8.     return $args;
  9. }
  10. add_filter( 'jnews_default_query_args', 'prevent_current_post_from_module' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement