pre_get_posts for exclude category
This code works perfectly function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1’ ); } } add_action( … Read more
This code works perfectly function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1’ ); } } add_action( … Read more
I am trying to sort posts by custom taxonomy. I have a custom post type which is course-cpt and I have created custom … Read more
This question is a follow up to a question I recently asked. I’ve implemented what seemed to be the only solution, and it … Read more
I am a new WP plugin developer. I want the search page to include only the current user’s posts. I first added a … Read more
I have a meta_key on all posts that is designed to check the current user role and only return the post if the … Read more
I have two loops in archive.php, both are affected by pre_get_post. My code on pre_get_post is this: // My pre_get_post function my_pre_get_posts( $query … Read more
I have created a filter to skip first post of the archive on “podcast” category. Below is the code. add_filter( ‘pre_get_posts’, ‘amd_limit_posts’); function … Read more
I want that my search page give results of posts (that i want that show) and taxonomy The code to get just two … Read more
I have a category archive page (press), which I need to loop through posts of a certain tag (magazines). I tried to modify … Read more
My understanding is, that custom post types can share tags with the posts also. I have created tags and applied them to a … Read more