Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    You can’t do this directly right now within the settings.

    You could write a function to filter tptn_exclude_post_ids
    https://github.com/WebberZone/top-10/blob/master/includes/class-top-ten-query.php#L251

    Thanks Ajay for the tip!

    I pushed current post ID into $exlude_post_ids array and it worked.
    Added array_push($exclude_post_ids, strval(get_the_ID()));
    after
    $exclude_post_ids = apply_filters( 'tptn_exclude_post_ids', $exclude_post_ids, $args );

    • This reply was modified 3 years, 5 months ago by edzis632.
    • This reply was modified 3 years, 5 months ago by edzis632.
    Plugin Author Ajay

    (@ajay)

    @edzis632

    Did you edit the code? If so, you might have an issue with the next update and you’ll have to add it again.

    You can try this code in your functions.php or a mu-plugins

    function tptn_exclude_current_post( $exclude_post_ids ) {
    
    	array_push( $exclude_post_ids, absint( get_the_ID() ) );
    	$exclude_post_ids = array_filter( $exclude_post_ids );
    
    	return $exclude_post_ids;
    
    }
    add_filter( 'tptn_exclude_post_ids', 'tptn_exclude_current_post' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude current post’ is closed to new replies.