SQL error “AS p” when themes search for previous and next post
-
I just update my blog to WP 2.3.
In a single post page (use single.php of theme), I have a database error :
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘AS p WHERE p.post_date < ‘2007-09-08 14:27:23’ AND p.post_type = ‘post’ AND p. ‘ at line 1]
SELECT p.ID, p.post_title FROM (wp_posts LEFT JOIN wp_postmeta as pl_wp_postmeta ON (wp_posts.ID = pl_wp_postmeta.post_id)) AS p WHERE p.post_date < ‘2007-09-08 14:27:23’ AND p.post_type = ‘post’ AND p. (wp_posts.post_status = ‘publish’ OR (wp_posts.post_status = ‘private’ AND (pl_wp_postmeta.meta_key = ‘post_level’ AND pl_wp_postmeta.meta_value <= 10 ))) ORDER BY p.post_date DESC LIMIT 1It comes from the “previous_post_link” and the “next_post_link” function. I have seen in Google that at least 3 blogs have this bug.
What should I do ? did I updated bad ?Actually, the SQL is clearly bad, the position of “AS p” should be just after the “FROM wp_post” and not just before “WHERE”. It means that the function “previous_post_link” construct badly the SQL query, but I don’t want to change a WP function !
- The topic ‘SQL error “AS p” when themes search for previous and next post’ is closed to new replies.