Unexplainable redirect in WordPress

I manage more than 20 WordPress sites. At one of my sites, one of the pages was redirecting to the homepage. I couldn’t find out why and had to spend many hours to find it. I did the following:

  • I disabled all plugins and tried again. No success
  • I checked out the .htaccess file to find redirection rules. No success
  • I copied the site to a test location, and removed all the plugins. No Success
  • I removed all non WordPress-core tables. No Success
  • I opened up the wp-options table, and removed all non WordPress-core records. No Success
  • I banged by head against the wall, and teared out all my hair. No Success
  • I removed all pages and posts, except for my home page and the post that wouldn’t load. No Success
  • I downloaded a WordPress database cleaner and cleaned up all revisions and garbage. No Success.

Can you believe I was crying a 1000 tears?

Now my database was super clean. So I checked out the wp-posts tables. There is a field ‘post_name’. The post_name of my homepage had the same name as the post that wouldn’t load. After I changed that name, everything worked OK!

My lessons: When WordPress processes a URL, it loads all posts with the name in the URL and redirects to the first one. When there are more posts with that name, you can get undesired results 🙁

My questions: How can I see this in the WordPress Admin interface? I couldn’t find it and because of that, couldn’t change it. I’m I the only one?

Posted in Uncategorized.

Leave a Reply

Your email address will not be published.