Created
January 14, 2019 07:07
-
-
Save MjHead/ec28faabb06cf51ee3c98f3bbd154fdc to your computer and use it in GitHub Desktop.
Exclude current post from Smart Posts List widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'jet-blog/smart-listing/query-args', 'jet_smart_list_exclude_current' ); | |
function jet_smart_list_exclude_current( $query_args ) { | |
if ( ! empty( $query_args['post__not_in'] ) && in_array( '%current_id%', $query_args['post__not_in'] ) ) { | |
$query_args['post__not_in'] = array( get_the_ID() ); | |
} | |
return $query_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment