Set Transient on CPT

Submitting a full blown answer now that we’ve figured it out. Transients can be hard to troubleshoot because if you save the wrong value to the database at first, you can be looking at an old—and bad—value, even if the code that sets your transient is now correct. The two ways you can fix this … Read more

Query post Pagination Problem

I go the solution. I have take variable name like $wp_query = new WP_Query($arr); instate of $the_query = new WP_Query($arr); So my working code should be <div id=”primary” class=”content-area”> <main id=”main” class=”site-main” role=”main”> <?php // global $wp_query; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $arr = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 3, ‘paged’ => … Read more

Filter custom post type by custom taxomony

Ok, so the answer here is both annoying and fairly difficult to find/fix. The wp_dropdown_categories() function outputs the dropdown for each custom taxonomy filter using the term_id as the value for each option. However, when constructing the query the WP_Query::parse_tax_query() method, by default, sets the field element to slug. So, I had to make a … Read more

WP_Query a custom field value bringing back 0 results

UPDATE: Ok this should work, according to ACF’s documentation: $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘page’, ‘meta_query’ => array( array( ‘key’ => ‘feature_on_front_page’, ‘value’ => ‘featured’, ‘compare’ => ‘LIKE’ ), ) ); Your code works for me. Can you see the feature_on_front_page custom field when you view the page(s) in the WordPress admin … Read more