I noticed recently that when I try to search through posts in the Manage Posts web admin page, I get a database error, and the search fails to yield results even though posts exist containing that string. I tested my plugins, and it seems that I need both the Search Everything (v4.6.2) and Bad Behavior (v2.0.16) plugins turned on in order to exhibit the bug.
I’m running WordPress 2.5.1 –is there a workaround for this?
1. Make sure you have the Search Everything (v4.6.2) and Bad Behavior (v2.0.16) plugins installed and activated.
2. Go to Manage > Posts, and in the Search Posts textfield, enter a string which exists in at least one post. For example, the word “test”
3. Hit the Search Posts button or the enter key. Rather than displaying the matching posts, I get the following 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 '(wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts' at line 1] SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts LEFT JOIN wp_term_relationships AS trel ON (wp_posts.ID = trel.object_id) LEFT JOIN wp_term_taxonomy AS ttax ON ( ( ttax.taxonomy = 'category' OR ttax.taxonomy = 'post_tag' ) AND trel.term_taxonomy_id = ttax.term_taxonomy_id) LEFT JOIN wp_terms AS tter ON (ttax.term_id = tter.term_id) LEFT JOIN wp_comments AS c ON ( comment_post_ID = ID ) WHERE 1=1 AND (((wp_posts.post_title LIKE '%test%') OR (wp_posts.post_content LIKE '%test%') OR (wp_posts.post_excerpt LIKE '%test%'))) AND wp_posts.(wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') OR ( tter.name LIKE '%test%') OR ( tter.slug LIKE '%test%') OR ( c.comment_post_ID = wp_posts.ID AND c.comment_content LIKE '%test%') ORDER BY wp_posts.post_date DESC LIMIT 0, 15
- The topic ‘[Search Everything & Bad Behavior] WP database error searching in Manage Posts’ is closed to new replies.