Support » Plugin: Ultimate Posts Widget » Exclude Current Post

  • I not see any front-end option to exclude the current post from the Widget like many other similar plugins have.

    Surprisingly –I am bot a coder– it seems that I managed to do it with this function.php filter:

    add_filter(‘upw_wp_query_args’, ‘upw_only_posts_with_thumbnails’,10 , 2);
    function upw_only_posts_with_thumbnails($args, $instance) {
    if( is_singular() && !isset( $args[‘post__in’] ) )
    $args[‘post__not_in’] = array( get_the_ID() );
    return $args;

    I use the custom template option.

    Still, I think there should be an easier way to get it.

  • The topic ‘Exclude Current Post’ is closed to new replies.