Title: Searching single apostrophe(&#8216;) causes SQL error
Last modified: April 4, 2017

---

# Searching single apostrophe(‘) causes SQL error

 *  [pavelinnuendo](https://wordpress.org/support/users/pavelinnuendo/)
 * (@pavelinnuendo)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/searching-single-apostrophe-causes-sql-error/)
 * Test case:
    – into search input box write just and the only apostrophe(‘) – URL
   will look: ?s=%27 – in error log, you can see the message bellow.
 * WordPress database error You have an error in your SQL syntax; check the manual
   that corresponds to your MariaDB server version for the right syntax to use near‘)))
   AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’, ‘accord_posts’, ‘e’ 
   at line 1 for query 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’ OR ttax.taxonomy = ‘post_format’ OR ttax.taxonomy = ‘accord_taxonomy’
   OR ttax.taxonomy = ‘explandict_dictionary’ ) 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 cmt ON ( cmt.comment_post_ID = wp_posts.ID ) LEFT JOIN
   wp_postmeta AS m ON (wp_posts.ID = m.post_id) WHERE 1=1 AND ( ( ((())) AND wp_posts.
   post_type IN (‘post’, ‘page’, ‘attachment’, ‘accord_posts’, ‘explandict’) AND(
   wp_posts.post_status = ‘publish’ OR wp_posts.post_type = ‘attachment’ OR wp_posts.
   post_author = 1 AND wp_posts.post_status = ‘private’)) AND post_type != ‘revision’)
   AND post_status != ‘future’ ORDER BY wp_posts.post_title LIKE ‘%\\’%’ 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

Viewing 1 replies (of 1 total)

 *  Plugin Author [Sovrn](https://wordpress.org/support/users/sovrn/)
 * (@sovrn)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/searching-single-apostrophe-causes-sql-error/#post-8998533)
 * Hello [@pavelinnuendo](https://wordpress.org/support/users/pavelinnuendo/),
 * Thank you for your inquiry and we apologize for any inconvenience this may be
   causing. We are actively investigating the issue and working on a solution.
 * Thank you for your patience in resolving this issue.
 * Regards,
 * Sovrn Support

Viewing 1 replies (of 1 total)

The topic ‘Searching single apostrophe(‘) causes SQL error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/search-everything_242529.svg)
 * [Search Everything](https://wordpress.org/plugins/search-everything/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/search-everything/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/search-everything/)
 * [Active Topics](https://wordpress.org/support/plugin/search-everything/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/search-everything/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/search-everything/reviews/)

## Tags

 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * 1 reply
 * 2 participants
 * Last reply from: [Sovrn](https://wordpress.org/support/users/sovrn/)
 * Last activity: [9 years, 2 months ago](https://wordpress.org/support/topic/searching-single-apostrophe-causes-sql-error/#post-8998533)
 * Status: not resolved