1

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

2

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

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 

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.

2
  • so, what do you suggest i do? How i know which plugin that causing this problem? I'm really new with this. Commented 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. Commented Nov 26, 2015 at 9:12

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.