Home » Delete your 404 errors with a mysql query
Delete your 404 errors with a mysql query

If you know how to run SQL queries, and are aware of what you are doing then you can try this query to delete 404 redirection errors using the given query.

Once thing you will need to change in this query is everywhere there is wp_posts you will need to change the prefix according to the setup you have on your system.

Which means in wp_posts which is a table and in it wp_ is the prefix in the name of posts table. So most probably the prefix of your table would be different than this.

How to find WordPress table prefix?

You can go to wp-config.php file, open that file and look for $table_prefix and the value of that will be your table prefix as show in the screenshot below..

WordPress table prefix

So once you find the prefix of your WordPress site table, you will need to replace it every where it is written in the query wp_posts.

So according to the screenshots table prefix the change would be wpxv_posts where wpxv_ is the prefix.

SQL Query to delete 404 redirection error

DELETE wp_posts
FROM wp_posts
LEFT JOIN wp_postmeta
ON (wp_posts.ID = wp_postmeta.post_id
AND wp_postmeta.meta_key = '_siteseo_redirections_type' )
WHERE 1=1
AND ( wp_postmeta.post_id IS NULL )
AND wp_posts.post_type = 'siteseo_404'
AND (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');
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list