WP_Query does not fetch posts
-
[Moderator note: moved to How-To and Troubleshooting]
$line[0]="Santa's Wild Ride"; $query = new WP_Query(array('post_type'=>'it_games', 'tax_query' => array( array( 'taxonomy' => 'game_name', 'field' => 'name', 'terms' => stripslashes_deep($line[0]) ) ) )); $id=0; if($query->have_posts()) $id=$query->post->ID; echo $id;
That code does not find posts. But I checked in admin panel there’s post with this term in this taxonomy.
I use exactly same code to find games which names don’t contain apostrophe and it works!
But it also does not work for terms with symbols “(“, “)”.
What am I doing wrong?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘WP_Query does not fetch posts’ is closed to new replies.