[wp-hackers] query_posts orderby not working properly
mikeschinkel at newclarity.net
Sat Aug 14 07:27:12 UTC 2010
You've got a plugin or a theme hook that's causing the problem (either that or you've got sticky posts that are confusing you.)
I ran this query with v3.0.1:
And on line 2416 of /wp-includes/query.php $this->request contained the following SQL (I pretty formatted it to make it easier to read):
INNER JOIN wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id
INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
1 = 1
AND wp_term_taxonomy.taxonomy = 'category'
AND wp_term_taxonomy.term_id IN('1')
AND wp_posts.post_type = 'post'
AND wp_posts.post_status = 'publish'
If sticky posts are the problem this should solve it:
Otherwise try disabling all plugins and switch to a default theme to see if it fixes it. If so, start enabling things until you figure out which is causing the problem.
Hope this helps.
On Aug 14, 2010, at 2:58 AM, Brian Fidler wrote:
> it gives me DESC order regardless of whether I choose ASC or DESC. I
> actually need ASC order.
> On Fri, Aug 13, 2010 at 9:22 PM, Jake Goldman <
> wphackers at jakemgold.myfastmail.com> wrote:
>> Valid options for orderby and order:
>> Your first example certainly shouldn't work. You can't order by a specific
>> post's title. I'm not sure why the second example isn't working for you, but
>> I can attest to the fact that it /does/ work.
>> What order does it give you?
>> On 8/13/2010 11:57 PM, Brian Fidler wrote:
>>> I'm having a problem getting a query to order properly. This is what I
>>> currently have:
>>> $post->post_title . '&order=DESC');
>>> I've also tried:
>>> Any idea what I could be missing?
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers