Custom Query With Multiple Meta Key Value

Try this: <?php $querydetails = ” SELECT wposts.* FROM $wpdb->posts wposts INNER JOIN ( SELECT post_id FROM $wpdb->postmeta wpostmeta WHERE ( ( wpostmeta.meta_key = ‘type’ AND wpostmeta.meta_value LIKE ‘%Collection1%’ ) OR ( wpostmeta.meta_key = ‘type’AND wpostmeta.meta_value LIKE ‘%Collection2%’ ) OR ( wpostmeta.meta_key = ‘type’AND wpostmeta.meta_value LIKE ‘%Collection3%’ ) OR ( wpostmeta.meta_key = ‘type’AND wpostmeta.meta_value LIKE … Read more

URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php

The issue is that %month% isn’t a recognized rewrite tag. If you add the tag within your init action and flush permalinks, the query will succeed. function register_story_post_type(){ // your post type registration stuff here, and then… add_rewrite_tag( ‘%month%’,'([^&]+)’ ); } add_action(‘init’,’register_story_post_type’); There are also about a hundred ways you could otherwise clean up that … Read more

WP_Query and two custom fields returns no posts

The first query gives the expected results when the date format was corrected. $query = new WP_Query(array( ‘post_type’=>’games’, ‘orderby’=>’menu_order’, ‘order’=>’asc’, ‘posts_per_page’ => 1, ‘meta_query’=> array( ‘relation’=>’AND’, array( ‘key’=>’game_date_time’, ‘value’=>$nowtoday, ‘compare’ =>’>’ ), array( ‘key’=>’home_team’, ‘value’=>’Allen’, ‘compare’=>’LIKE’ ) ) ));