wp-show-posts icon indicating copy to clipboard operation
wp-show-posts copied to clipboard

Exclude sticky posts for queries with taxonomy.

Open ejcabquina opened this issue 4 years ago • 0 comments

By default, "ignore_sticky_posts" check box will only work post queries w/o taxonomy.

Consider changing this line of the code:

if ( $settings[ 'ignore_sticky_posts' ] ) {
	$args[ 'ignore_sticky_posts' ] = $settings[ 'ignore_sticky_posts' ];
}

To this:

if ( $settings[ 'ignore_sticky_posts' ] ) {
    if( ! empty( $settings[ 'taxonomy' ] ) && ! empty( $settings[ 'tax_term' ] ) ){
        $sticky = get_option( 'sticky_posts' );
        $args['post__not_in'] = $sticky;
    } else{
        $args[ 'ignore_sticky_posts' ] = $settings[ 'ignore_sticky_posts' ];
    }
}

ejcabquina avatar Sep 15 '21 02:09 ejcabquina