Wordpress shows 404 page when saving new post or editing post

10,915

Solution 1

Go through the below steps, may resolve your issue.

  1. First of all make sure that there is a file named as ‘post.php’ in ‘wp-admin’ folder.

  2. Then disable all Plugins and try again. If it works, enable each Plugin one by one to discover what is causing this issue.

  3. If the above one doesn’t help you, go to your ‘Admin > Settings > Permalinks’. Don’t change anything on that Permalinks page, but just click the button ‘Save Changes’ exists at the bottom. Now try to publish a post.

  4. If you still experience the issue, choose the option ‘Default’ in Permalinks page then save changes. After that you can set it again to the previous permalink option or keep it as Default as you wish. Then try to publish a post.

  5. If the problem exits however, check the “WordPress address (URL)” and “Blog address (URL)” have set correctly in ‘Settings > General’ (no slash at the end of the URLs).

  6. After that remove the link ‘http://rpc.pingomatic.com/‘ from the field ‘Update Services’ exists at ‘Settings > Writing’ and try again to publish a post.

  7. If problem appears yet with all above changes, copy the code given below and paste in the .htaccess file. Code to be Added


    RewriteEngine On
    RewriteBase /
    RewriteRule ^index.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

Solution 2

I have not sorted this real solution as none of the above has worked for me. I do have work around.. If you can get to the Pages in the dashboard but the Posts gives you a 404 then just go to the Pages and replace the querysting.

https://YOURDOMAIN.com/wp-admin/edit.php?post_type=page

change to:

https://YOURDOMAIN.com/wp-admin/edit.php?post_type=post

Solution 3

I could not fix the problem by the methods mentioned here.

What worked for me was simply disabling ModSecurity in cPanel.

Solution 4

disabling ModSecurity in cPanel worked for me after i tried everything.

Share:
10,915
Otuoma Sanya
Author by

Otuoma Sanya

Updated on October 11, 2022

Comments

  • Otuoma Sanya
    Otuoma Sanya over 1 year

    Problem is ... when I click on edit post/edit page, it tries to open http://localhost/site/wp-admin/post-108.php?post=286&action=edit and ends up on 404 page. It also shows the 404 page when saving a new post/page.

    I don't remember exactly what I did but it must have started after my IDE refactored the code when I was renaming a template file.

    There is no post-108.php inside wp-admin folder or inside my theme folder, but there's post.php. I don't know why it is trying to open post-108.php which does not exist.

    NOTE: It is a custom theme I am building myself using wordpress 4.7.4

    Thank you all.