Title: WordPress database error Table doesn&#039;t exist for query
Last modified: August 24, 2016

---

# WordPress database error Table doesn't exist for query

 *  [mallorydxw-old](https://wordpress.org/support/users/tomdxw/)
 * (@tomdxw)
 * [11 years ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/)
 * We’re getting this error on a site:
 * `WordPress database error Table 'wordpress.wp_31_redirection_items' doesn't exist
   for query SELECT wp_31_redirection_items.*,wp_31_redirection_groups.tracking,
   wp_31_redirection_groups.position AS group_pos,wp_31_redirection_modules.id AS
   module_id FROM wp_31_redirection_items INNER JOIN wp_31_redirection_groups ON
   wp_31_redirection_groups.id=wp_31_redirection_items.group_id AND wp_31_redirection_groups.
   status='enabled' INNER JOIN wp_31_redirection_modules ON wp_31_redirection_modules.
   id=wp_31_redirection_groups.module_id AND wp_31_redirection_modules.type='wp'
   WHERE( wp_31_redirection_items.regex=1 OR wp_31_redirection_items.url='/category/
   test/') made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('/
   var/vhost.../wp-config.php'), require_once('wp-settings.php'), do_action('init'),
   call_user_func_array, WordPress_Module->init, Red_Item::get_for_url`
 * [https://wordpress.org/plugins/redirection/](https://wordpress.org/plugins/redirection/)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Pierre](https://wordpress.org/support/users/ierpe/)
 * (@ierpe)
 * [11 years ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6095838)
 * I have the same problem :
    `WordPress database error: [Table 'mysite.wp_redirection_items'
   doesn't exist]`
 * When I turn the debug off it disappears but…
 *  [mipaca](https://wordpress.org/support/users/mipaca/)
 * (@mipaca)
 * [11 years ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6095886)
 * I am seeing the same issue. The tables are not be created when the plugin is 
   activated. I am running on WP 4.2.2 using a custom table prefix.
 *  [withinboredom](https://wordpress.org/support/users/withinboredom/)
 * (@withinboredom)
 * [11 years ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6095956)
 * Also seeing this on multisite, did you hook into the multisite network upgrade
   hook?
 * `PHP message: WordPress database error Table 'flagship.wp_1239_redirection_404'
   doesn't exist for query SHOW FULL COLUMNS FROM`wp_1239_redirection_404`made by
   require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'),
   do_action('template_redirect'), call_user_func_array, WordPress_Module->template_redirect,
   RE_404::create` is filling my logs!
 *  [bc_nerd](https://wordpress.org/support/users/bcaplan/)
 * (@bcaplan)
 * [11 years ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6095977)
 * I am getting the same error when I use the wp command line tool if this plugin
   is activated.
 * Current wordpress and plugins all up to date.
 * wp command line tool: [http://wp-cli.org/commands/plugin/](http://wp-cli.org/commands/plugin/)
 *  [shelbourne1](https://wordpress.org/support/users/shelbourne1/)
 * (@shelbourne1)
 * [11 years ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096000)
 * Same issue here. Tried installing version 2.3.16 that was released today (5/25/
   15) but issue persists. Getting error on each page of front-end site when Redirection
   is activated stating the table wp_redirection_items doesn’t exist. WordPress 
   and all other plugins up to date. This is a new Redirection install.
 * Additional error information:
 * WordPress database error: [Table ‘user_wp946.wp_redirection_items’ doesn’t exist]
   
   SELECT wp_redirection_items.*,wp_redirection_groups.tracking,wp_redirection_groups.
   position AS group_pos,wp_redirection_modules.id AS module_id FROM wp_redirection_items
   INNER JOIN wp_redirection_groups ON wp_redirection_groups.id=wp_redirection_items.
   group_id AND wp_redirection_groups.status=’enabled’ INNER JOIN wp_redirection_modules
   ON wp_redirection_modules.id=wp_redirection_groups.module_id AND wp_redirection_modules.
   type=’wp’ WHERE( wp_redirection_items.regex=1 OR wp_redirection_items.url=’/’)
 *  [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096020)
 * same here
 *  [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096021)
 * So i just noticed it’s not creating *any* of the tables with a new install.
 *  [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096022)
 * So here is the temporary fix until a developer wants to chime in:
 * edit models\database.php
 * Line 44 is function plugin_activated()
 * add this just after the function declaration:
 *     ```
       include dirname( REDIRECTION_FILE ).'/models/database.php';
   
       $db = new RE_Database();
       $db->install();
       ```
   
 * So you have, in full–
 *     ```
       public static function plugin_activated() {
       		include dirname( REDIRECTION_FILE ).'/models/database.php';
   
       		$db = new RE_Database();
       		$db->install();
   
       		Red_Flusher::schedule();
       	}
       ```
   
 * Then deactivate and re-activate the plugin.
 *  [Pierre](https://wordpress.org/support/users/ierpe/)
 * (@ierpe)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096023)
 * If you use git and github, you should make a pull request :
 * [https://github.com/johngodley/redirection/](https://github.com/johngodley/redirection/)
 * If you don’t, I can do it!
 *  [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096024)
 * In my previous post I accidentally wrote that you edit line 44 of models\database.
   php. Meant redirection\redirection-admin.php.
 * Anyways, I created a pull request: [https://github.com/johngodley/redirection/pull/60](https://github.com/johngodley/redirection/pull/60)
 *  [balex66](https://wordpress.org/support/users/balex66/)
 * (@balex66)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096048)
 * I’m seeing this error as well
 *  [Rapidozack](https://wordpress.org/support/users/rapidozack/)
 * (@rapidozack)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096051)
 * Same issue here, event after deleting the plugin… Any idea how to fix it ?! Thanks
   🙂

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘WordPress database error Table doesn't exist for query’ is closed to 
new replies.

 * ![](https://ps.w.org/redirection/assets/icon-256x256.jpg?rev=983639)
 * [Redirection](https://wordpress.org/plugins/redirection/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/redirection/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/redirection/)
 * [Active Topics](https://wordpress.org/support/plugin/redirection/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/redirection/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/redirection/reviews/)

 * 12 replies
 * 9 participants
 * Last reply from: [Rapidozack](https://wordpress.org/support/users/rapidozack/)
 * Last activity: [10 years, 9 months ago](https://wordpress.org/support/topic/wordpress-database-error-table-doesnt-exist-for-query/#post-6096051)
 * Status: not resolved