This is REALLY strange!
I’ve got a custom post type (named ‘my_custom_post_type’). When I try to query for a specific one of these custom posts I get different results depending on the browser I’m using, which makes no sense to me.
My code is:
$args = array ( 'post_type' => 'my_custom_post_type', 'p' => 12, 'post_status' => array ('publish', 'pending') ) ; $query = new WP_Query ($args) ;
If the post with post_type = ‘my_custom_post_type’ whose ID = 12 has status ‘publish’ or ‘pending’ it is found when I’m using Firefox (v17.0.1). However, if that post has status ‘pending’, then it is not found when I use IE (v8), Chrome (v23.0.1271.95 m), Safari (v5.1.7) and Opera (v11.62).
I’m using WordPress v3.4.1 and the browsers are running on a Windows Vista SP2 machine (which is different from the machine WP is running on).
I have verified that
$query->requestis IDENTICAL in all cases (see below), which is why this makes no sense to me!
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID = 12 AND wp_posts.post_type = 'my_custom_post_type' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'pending') ORDER BY wp_posts.post_date DESC
Please help! This is for a site I’m developing for a client that is supposed to go-live next week and I need to fix this problem ASAP.
- The topic ‘WP_Query() returning different results depending on browser’ is closed to new replies.