[wp-trac] [WordPress Trac] #15995: query is separating post_type 'post' from custom post_types when retrieving custom field
WordPress Trac
wp-trac at lists.automattic.com
Tue Dec 28 11:58:49 UTC 2010
#15995: query is separating post_type 'post' from custom post_types when retrieving
custom field
-------------------------------+------------------------------
Reporter: bowstreet | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Types | Version: 3.0.3
Severity: normal | Resolution:
Keywords: reporter-feedback |
-------------------------------+------------------------------
Comment (by dd32):
Thanks for the follow up,
I've re-tested using meta as well, and ordering by title (as the initial
ticket says) and ordering by modified (as your code is doing) is working
correctly for me.
I've tried marking some of the posts as sticky, and that's not affecting
the results either.
Can you try executing the SQL query directly and see if the ordered
results are correct?
The SQL in your case is:
{{{
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts JOIN wp_postmeta ON
(wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type IN
('post', 'issues', 'videos') AND (wp_posts.post_status = 'publish') AND
wp_postmeta.meta_key = 'sticky' AND wp_postmeta.meta_value = 'yes' GROUP
BY wp_posts.ID ORDER BY wp_posts.post_modified ASC LIMIT 0, 10
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/15995#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list