I have wordpress site where I have this url:

site.com/my-post this post is a page. But when i go to that page I gives me a 404. I can't find the page anywhere in my admin. But When I try to create a new page with site.com/my-post it automatically changes the slug to site.com/my-page-2

How can I solve this problem? Please note That I have access to the MySql database and therefore I am able to change things if necessary.



Within Wordpress, nearly everything is a "post" of varying "post-types". Posts, Pages and Media attachments all share the same "URL-Base" (meaning they don't have something before the title in the URL), which means that slugs need to be unique within all these post types.

Please check if there are Posts or Media Attachments using the same title/the same slug. Check the Trash also.

| improve this answer | |

Have you checked to refresh you permalink structure? http://www.wpbeginner.com/wp-tutorials/how-to-fix-wordpress-posts-returning- 404-error/

Can you try once saving permalink structure again to default. Check if it works:

Admin > Settings > Permalinks

If it works, switch it to desired permalink option and check it again.

Have you installed some of the Debugging plugins for WordPress? There are many good Debugging plugins: Debug this works great for me.

Here is the article describing to to use it. http://websynthesis.com/fixing-wordpress-404-errors/.

| improve this answer | |

One way you end up with a slug like my-page-2 is when you have a page or post in the trash that has the slug of my-page, so the simplest thing to do is check your page and post trash and empty them, if needed.

If that doesn't work, reset permalinks: Using Permalinks « WordPress Codex and be sure the changes are written to the .htaccess file.

And be sure no other redirects are in .htaccess other than the standard WordPress rewrite block:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

If you can't save permalinks for some reason from Settings>>Permalinks, you may have to manually clear the permalinks setting in the database and then save them again from Settings>>Permalinks; the option is in wp_options and usually called permalink_options and is #34.

You can also use PHPMyAdmin or Adminer to search the database for the slug my-post and see where it is in use. Adminer « WordPress Plugins

| improve this answer | |
  • Hello, thanks for your reaction. But the trash is empty. – sanders Mar 10 '16 at 21:06
  • Ok, but try the other options I added in my answer. – markratledge Mar 11 '16 at 1:19

Permanently Delete Post from trash, clear cache and retry.

| improve this answer | |

this thing is that when you delete a post from wordpress main post area, it goes into trash folder and a string "__trash" is added as suffix in the URL.

before: abc.com/example/ after deleting: abc.com/example__trashed/

so, make sure to delete this post from trash folder too and then get back again if problem still persists.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.