Title: 404 Redirected SQL Syntax Problem
Last modified: August 22, 2016

---

# 404 Redirected SQL Syntax Problem

 *  [Craig Hesser](https://wordpress.org/support/users/bulgariarealtor/)
 * (@bulgariarealtor)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/404-redirected-sql-syntax-problem/)
 * There is an SQL syntax error caused by the SQL upgrade in WP some time ago. An
   example:
 * > [26-Mar-2015 14:26:00 UTC] 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 ‘status timestamp <= 1393251960 and id not
   > in (select redirect_id from t8wa4beu6_’ at line 1 for query select id from 
   > t8wa4beu6_wbz404_redirects where status = 2 status timestamp <= 1393251960 
   > and id not in (select redirect_id from t8wa4beu6_wbz404_logs) made by do_action_ref_array,
   > call_user_func_array, wbz404_cleaningCron
 * This shows up in the error file.
 * Site in question: [http://mobi.susanhesser.com/](http://mobi.susanhesser.com/)
 * [https://wordpress.org/plugins/404-redirected/](https://wordpress.org/plugins/404-redirected/)

Viewing 1 replies (of 1 total)

 *  [Minister](https://wordpress.org/support/users/lstavrevweb-ministercom/)
 * (@lstavrevweb-ministercom)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/404-redirected-sql-syntax-problem/#post-5947736)
 * I can confirm that as well – there is a sql syntax error!
 * Everybody could fix it by yourself (until the author fixes it and releases a 
   new version) following these instructutions:
 * # File /includes/functions.php, row ~402
    Search…: `//Find unused urls` `$query
   = "select id from " . $wpdb->prefix . "wbz404_redirects where status = " . $wpdb-
   >escape(WBZ404_AUTO) . " status ";`
 * …and replace the row with:
    `//Find unused urls` `$query = "select id from " .
   $wpdb->prefix . "wbz404_redirects where status = " . $wpdb->escape(WBZ404_AUTO)."
   and ";`
 * In short: you should replace the second match for word `status` with `and`.
 * This fixes the error in the logs and also makes the corresponding functionality
   working as set in the settings page!

Viewing 1 replies (of 1 total)

The topic ‘404 Redirected SQL Syntax Problem’ is closed to new replies.

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

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [Minister](https://wordpress.org/support/users/lstavrevweb-ministercom/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/404-redirected-sql-syntax-problem/#post-5947736)
 * Status: not resolved