Store sticky post’s ids in a transient

You can try: add_action(‘update_option_sticky_posts’, function( $old_value, $value ) { $featured_args = array( ‘post__in’ => $value, ‘post_status’ => ‘publish’, ‘no_found_rows’ => true ); // The Featured Posts query. $featured = new WP_Query( $featured_args ); // Proceed only if published posts with thumbnails exist if ( $featured->have_posts() ) { while ( $featured->have_posts() ) { $featured->the_post(); if ( … Read more

Show all post for a given category

You can use the WordPress Template Hierarchy. Copy your category.php file and rename it. category-{slug}.php – If the category’s slug is news, WordPress will look for category-news.php. category-{id}.php – If the category’s ID is 6, WordPress will look for category-6.php. category.php You can also use template_include to conditionally display a template add_filter( ‘template_include’, ‘category_page_template’, 99 … Read more

Order posts by taxonomy count

this topic might help you. By default args of WP_Query – this is impossible. I don’t think you can do that directly. Although you can save terms count for each post in a custom meta field (on post publish) and then in your query define sort by that meta field. Or while running your query, … Read more

WP_Query: include custom post type only with specific meta value

If the key-2 is uniquely assigned to cpt-3 post type, then you can add another meta query argument to your query arguments: array( ‘key’ => ‘key-2’, ‘value’ => 1, ‘compare’ => ‘=’ ) If not, you can run another query, and then merge them as follows: $final_query = array_merge( (array) $query_1, (array) $query_2 ); But, … Read more