I have a weird bug on the dashboard: the dashboard says there are a total of 3 posts, but the list is empty and says “No posts found” (see image below)
It’s a fresh install on a shared Windows hosting, using SQL Server as the database with the WP Db Abstraction plugin. I tried reinstalling WP completely and the bug is still there. Before I reinstalled WP, I had configured it for multi-site, and I had the same issue in the site list.
I’m a complete newbie with WordPress and I have no idea how to fix this… any help would be greatly appreciated!
UPDATE: I investigated the queries issued to the database, and it seems that the query that is supposed to return the list of posts is this:
SELECT TOP 0 *
FROM wp_posts
WHERE 1=1
AND wp_posts.post_type LIKE 'post'
AND (wp_posts.post_status="publish" OR wp_posts.post_status LIKE 'future' OR wp_posts.post_status LIKE 'draft' OR wp_posts.post_status LIKE 'pending' OR wp_posts.post_status LIKE 'private')
ORDER BY wp_posts.post_date DESC
And of course, TOP 0
returns 0 rows… this query seems to be generated by the DB abstraction plugin when it tries to translate the LIMIT
clause to SQL Server.
So I guess my only options are:
- fix the bug (doesn’t seem easy, since there is no obvious translation for
LIMIT
in SQL Server) - or switch to a MySQL database…
3 Answers
Try the fix posted here: http://sourceforge.net/tracker/?func=detail&aid=3485384&group_id=315685&atid=1328061
It worked for me.
translations.php line 726
Change this: $pattern =
‘/LIMIT\s*(\d+)((\s*,?\s*)(\d+))(;{0,1})$/is’; to this: $pattern =
‘/LIMIT\s(\d+)((\s*,?\s*)(\d+)*);{0,1}$/is’;Removing the extra parentheses allows “LIMIT 0, 10” to become “TOP
10”. With the extra parentheses, the “0” is used instead.