Skip to content

Exclude sticky posts for queries with taxonomy. #41

Description

@ejcabquina

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' ];
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions