How to find and correct unexpected redirects.
Here's some things you should check:
Check your .htaccess
file in the root folder of your WordPress installation. Check for any redirection rules.
Disable any SEO plugins (or specifically: redirection plugins -- if
you use these) you might have installed. And actually you should probably just disable ALL plugins. Clear browser cache and temporary files, and reload the front-end of your website. See if the problem disappears. Enable plugins 1 by 1 until the problem becomes apparent once again. That will help to narrow down the culprit.
- Check your theme
functions.php
file to see if there's been any
hard coded redirection added by you or someone else once upon a
time.
- Check the database for old slugs.
- Once your website has been loaded on the front-end. View source.
Check for JavaScript redirects.
- Open up Google Chrome (Developer Tools) Click the Network tab.
Reload your page. Observe the changes.
- Search your entire website (files) for contents "
wp_redirect
".
Maybe there's been a redirect added to one of the files used by your
theme or a plugin.
- Search your entire website (files & database) for contents "
base64
".
Maybe there's been a sneaky redirect added to one of the files used by your theme or a plugin or inserted into your database somewhere. This is often a sign of a compromised website.
Here's the query for checking your database for option #4:
SELECT *
FROM `wp_postmeta`
WHERE `meta_key` = '_wp_old_slug'
In the "FROM" line (second line)... Make sure you specify the correct name of your "Post Meta" database table. (Your table prefix may differ -- but the default is wp_
)
If you wanted to get extra specific with option #4 you could enter the slug which the page is being redirected to.
SELECT *
FROM `wp_postmeta`
WHERE `meta_key` = '_wp_old_slug'
AND `meta_value` LIKE '%slug-to-search-for%'
Option #4 directly answers your question about locating and removing slugs from the database. However, it really could be any number of things... Hope this helps.