My php error_log keep showing this message,

WordPress database error Unknown column 'wp_postmeta.meta_value' in 'order clause' for query SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND 0 GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 DESC, wp_posts.post_date DESC LIMIT 0, 10 made ​​by require ('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

I never change something in my database.

Anyone knows something bout this or ever have this problem?

1 Answer 1


This wouldn't be caused by a change in the database. What the error refers to is this:

FROM   wp_posts
WHERE  1 = 1
       AND 0
GROUP  BY wp_posts.id
ORDER  BY wp_postmeta.meta_value + 0 DESC,
          wp_posts.post_date DESC
LIMIT  0, 10 

Your code only includes data from the wp_posts table (second line above) but is trying to ORDER BY data from the wp_postmeta table (sixth line). You can't do that. I doubt this is coming from WordPress Core, so a plugin or your theme is hooking a callback into one of the WP_Query hooks-- my guess is the posts_orderby filter. Something about that filter is broken and it is adding that wp_postmeta.meta_value bit indiscriminantly.

  • so, what do you suggest i do? How i know which plugin that causing this problem? I'm really new with this.
    – liah
    Nov 26, 2015 at 8:19
  • Disable your plugins one by one and see when the problem stops, then read the plugin code. Same with the theme-- switch themes, see if it stops.
    – s_ha_dum
    Nov 26, 2015 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.