Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Fix WordPress Posts Returning 404 Error (Step by Step)

Have you ever tried to open one of your WordPress posts only to be greeted by a 404 error? At times, we experience that when we’re working on our own WordPress sites or helping our users

This error occurs when you can access your WordPress admin area and blog, but when you try to open a specific post, you’re met with a “404 Not Found” message.

It can be frustrating to see your content seemingly disappear, but we’ve found some workarounds to fix this issue. In this complete guide, we’ll show you how to fix WordPress posts returning 404 errors.

How to fix WordPress posts returning 404 error

Why Are My WordPress Posts Returning a 404 Error?

There are several reasons why your posts might be showing a 404 “Page Not Found” error in WordPress. These can include:

  • Plugin or theme conflicts: Sometimes, plugins or themes you’ve installed on your site can interfere with how WordPress handles permalinks. This can lead to broken links and 404 errors.
  • Custom code issues: If you’ve added custom code to your website, there might be errors in the code that are affecting permalinks or causing other conflicts, resulting in 404 errors for your posts.
  • Issues with your .htaccess file: The .htaccess file plays a role in how WordPress structures URLs. If this file is corrupted or missing, it can lead to 404 errors for your posts or pages.

How to Find All WordPress Posts With 404 Errors

Before we get to the solutions, it’d be good to figure out if this error is just happening to one or two posts or multiple posts. This way, you can determine the scope of the problem and choose the most appropriate solution.

One easy way to figure this out is to use Google Search Console. If you haven’t submitted your site to Google Search Console already, then read our guide on how to add your WordPress site to Google Search Console.

Once the Google bot has crawled and indexed your site, Google Search Console will then provide you with detailed information about your site’s performance, including any 404 errors it encounters.

To find out which posts are returning 404 errors, you can log in to the Search Console dashboard. Then, navigate to the ‘Pages’ report, and you will see a detailed list of all the errors.

Google Search Console Pages Report

For more information, you can read our list of tips for using Google Search Console to grow website traffic, which includes some tips on how to fix 404 errors with the tool.

That being said, let’s look at how to fix WordPress posts returning 404 errors. You can use the links below to jump straight to different solutions:

No time to fix 404 errors yourself? WPBeginner Pro Services can help! With our affordable Emergency WordPress Support, you can hire experts to fix 404 errors, broken links, redirect issues, and much more. Stop stressing over WordPress issues and get them fixed! Schedule Emergency WordPress Support Services today!

Method 1: Check for Plugin or Theme Conflicts and Custom Code Issues

Sometimes, plugins, themes, or custom code you’ve added to your WordPress website can interfere with permalinks or cause conflicts, leading to 404 errors. We’ve even experienced it ourselves when we’re testing tools on our demo site.

One way to solve this problem is to temporarily deactivate plugins. Plugins can sometimes disrupt how WordPress handles links.

Once you’ve deactivated the plugins, you can reactivate them one by one while checking if the 404 error reappears after activating each plugin. If the error shows up after activating a specific plugin, that might be the culprit.

You can then do a quick Google search for solutions related to that plugin or contact the plugin developer for support.

Similarly, your WordPress theme might be causing the conflict.

To check, you can temporarily switch to a default WordPress theme like Twenty Twenty-Three or Twenty Twenty-Four. All you need to do is go to Appearance » Themes and click ‘Activate’ on a default theme.

Activating a default WordPress theme

If the 404 error disappears with the default theme, it indicates a potential conflict with your current theme. You can then try troubleshooting the theme or consider using a different theme.

You can check out our expert pick of the most popular WordPress themes for recommendations.

If you’ve recently inserted code snippets to your website, there might be errors in the code causing the 404 errors. Take a close look at the code you added and see if you can identify any mistakes.

The safest way to add code snippets to WordPress is with the WPCode plugin. This plugin lets you insert custom code without directly working with the theme files, reducing the risk of breaking your website.

Plus, whenever WPCode spots an error in your code, it will automatically deactivate the snippet and ask you to check it. You can also use the testing mode to check if your code works before pushing it to your live website.

WPCode error warning

If none of these solutions work, move on to the next method where we’ll troubleshoot your permalink settings.

WordPress posts can return 404 errors because of problems with rewrite rules in your .htaccess file. In most cases, you can fix the problem by updating your permalink settings.

Simply go to Settings » Permalinks in your WordPress admin, and click on the ‘Save Changes’ button.

Check Permalinks

There is no need to make changes to the permalink settings themselves. This will update your permalink settings and flush the rewrite rules.

In most cases, this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your .htaccess file manually.

Method 3: Update the WordPress .htaccess File

Before you start, make sure to back up your WordPress .htaccess file first. If something goes wrong, you can easily restore the original file.

Now, you will need to connect to your server using an FTP client like FileZilla or the File Manager app in your WordPress hosting dashboard.

Next, you will need to find and edit the .htaccess file, which is located in the same location as folders like /wp-content/ and /wp-includes/.

Simply right-click on the file and select ‘File permissions.’

.htaccess file permissions

You can make the file writeable by changing its permissions to 666.

Simply enter ‘666’ into the ‘Numeric value’ box and then click on ‘OK’.

Change file attributes for the .htaccess file to 666

Then, you need to repeat the steps in the first method of our tutorial. Once you have done this, don’t forget to change the permissions back to 660.

You can also edit the file and add code to it.

Edit .htaccess file

Once you have opened the .htaccess file with a text editor, simply insert this code:

# 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]
</IfModule>
# END WordPress

Method 4: Contact Your Hosting Provider

If neither of the solutions above has fixed the WordPress posts returning 404 error, then we recommend contacting your WordPress hosting provider. There may be an error on their end, or they might be able to help you troubleshoot the problem.

Please also see our guide on how to properly ask for WordPress support and get it.

Method 5: Enable mod-rewrite (Local WordPress Installation)

If you are using a local server for testing purposes, then you will need to enable mod_rewrite in the Apache configuration of your MAMP, WAMP, or XAMPP site.

This will allow WordPress to generate clean URLs and prevent the 404 error for posts and pages on your local server.

How you do this will differ by the platform you use. People using XAMPP can open their control panel and click the ‘Config’ button within Actions. Then, select ‘Apache (httpd.conf).’

The Apache (httpd.conf) menu on XAMPP

Next, you will need to find this line #LoadModule rewrite_module modules/mod_rewrite.so and remove the ‘#’ to uncomment it.

This will load the mod_rewrite.

Finding the rewrite_module on httpd.conf file

Then, find all instances of AllowOverride None and change them to AllowOverride All.

The ‘All’ value means that all directives can be overridden.

Changing AllowOverride None to AllowOverride All

Once done, you can save the httpd.conf file and close it. After that, in the XAMPP control panel, click ‘Stop’ on the Apache module and ‘Start’ again to restart it.

Then, go back to your admin dashboard to see if your permalinks are working.

Video Tutorial

If you need visual instructions, then just watch the video below.

Subscribe to WPBeginner

We hope this article helped you resolve the posts returning 404 errors in WordPress. You may also want to see our guide to the most common WordPress errors and how to fix them, along with our expert picks for the best WordPress plugins to grow your site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

773 CommentsLeave a Reply

  1. taher

    My problem is a little different i do have access to my wp-admin, But i am unable to access to any page within wordpress, including dashboard or settings and re-directed to 404-error page. I have disabled cloudfare, but the problem persists.

  2. sikkandhar

    great help, by just changing theme of wordpress, my 404 errors solved,
    thank you for simple and great idea.

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  3. Oswaldo

    Thanks for this amazing solution. I have a membership site and when i looked up to my mail this morning i have a lot of users that wrote that the cant access to the page because is showing the 404 error message and in fact this was happening, i didint know what to do, i thought it was some plugin or some function i put the night before….

    Then i found this post, i saved again the permalinks as shown in this post and WORKED!!! :)

    but i am not happy yet, i want to know why happened this problem? so this wont repeat again :( because all night while i was sleeping this problem happened :(

    please can you tell us, why happened this problem, so we can avoid this?

    Thank you

    • WPBeginner Support

      Sadly, it is difficult to say the root cause. It could have been an update from the host’s end or something on your site could have updated your permalinks incorrectly as some possibilities.

      Admin

  4. Lina Jin

    I checked .htaccess and permalink settings too but its still not working.
    In pages, I can see only some pages and others show errors.
    ‘Trying to get property ‘post_author of non-object in C:\xampp\htdocs\aaa\wp-admin\incldues\class-wp-posts-list-table.php on lline 1180’

    So the page links are not working and after login, the homepage is automatically redirected to wp-admin and dashboard shows nothing.
    Can you help me with this?

  5. Harry

    Thank you for this tutorial, solved my problem.

    • WPBeginner Support

      Glad our article could help :)

      Admin

  6. kaleab

    i had the same problem geting 404 error in post.php …it was frustrating but the only thing worked form me was change the the theme..and change it again…it worked for me………..

    • WPBeginner Support

      Thanks for sharing what worked for you :)

      Admin

    • TrigienIT

      i had the same issue. tried the options above but they did not work until I also changed the theme to another, then reverted back to the normal theme.

  7. José

    None of the solutions worked for me. I can only acces to my home page, any other link like pages & post are not working. The update that caused this was the 5.0.3

  8. Nikki S

    Wheew! This DID work for me. All I had to do was hit the Save button. So thankful for the article.

    I just updated to WP 5.0.2 yesterday from 4.9.8. Could that have been the cause? It seems to run fine yesterday.

    • WPBeginner Support

      As with any technology, there are many possible reasons. It could have been the update, a hiccup with the host, or another unknown reason.

      Admin

  9. Anjalai

    am working in wordpress admin suddendly it showing 404 error message. so what am to do and i am beginner for wordpress

    • WPBeginner Support

      You would want to follow the steps in this article and should none of them work, reach out to your hosting provider and they should be able to assist.

      Admin

  10. Okan

    Thanks thanks thanks. You are the man!

  11. Mike

    Thank you so much. It worked. My site is fully back online. Thank you.

  12. RKapunan

    Thank you so much. My links are back!

  13. Jennifer Nelson

    Thank you!!!!

  14. Daniel S

    I have tried all the suggestions from the article and some from comments.
    Then I contacted my hosting company and it turned up that their ModSecurity module on the server blocked POST requests with “+src=” string in it.
    It could be different rule for you but if everything else fails try asking your hosting company to check if any request was blocked at the server level.

  15. zak

    thank you so much you are amazing, i love you so much, you are great, i searched a lot of pages and no one knows and teaches like you. you are awesome.
    Thank you Thank you Thank you

  16. Matzi

    Thank you. It worked perfectly.

  17. jay

    this is happening to our site almost monthly and the only way to fix is to reset the permalinks in wp dashboard. debug log file is clean so i dont have any clue where to start fixing. any one having the same problem?

    • Ronny

      I have the same problem! but I do not know where the problem comes from? does anyone know how to solve it?

  18. Musab

    Thaaanks many thanks

  19. Arlene

    My world was torn apart when I received this 404 error. Thank you WPBeginner for this helpful guide.

  20. Jerry Bordadora

    Thank you!! You save my me bro

  21. Toyin

    My issue has to do with the next page. I reduced the number of posts showing on my home page from 10 to 5, and when I click on the next page, it’s coming up with the 404 page not found

  22. Aram

    Hello! Thank You for interesting article! I have a little different problem. I want to redirect my 404 page to another, accurate and beautiful page. And normaly use plugins or template possibilities for that. But one of my sites, where there is the same template that I usually work with, the 404 page does not exist at all. Whatever I do. I get error telling that The requested document was not found on this server.

    • WPBeginner Support

      Hi Aram,

      Try updating your permalink structure. Simply visit Settings » Permalinks and then click on the save changes button without changing anything.

      Admin

  23. Ann-Jeanette

    I cannot put in words how grateful I am for this exact article. THANK YOU

  24. behdad

    extremely helpful thanks

  25. Renan

    Works like a charm!

  26. Morcio

    It works, thanks THAAANKS a lot!!

  27. Zihad

    Thanks for such an easy solution.

  28. Okereke Divine

    This article is actually very very helpful.

    But my problem seems to be different. Please WPBEGINNER, you guys should please and please help me…

    I have tried the methods above but its not working. though my problem is kindoff different.

    My problem is:
    Sometimes, When I try to update my previous post or make a new post.., it redirects me to “404 error. Please and please help me.

    • WPBeginner Support

      Hi Okereke,

      Please try these steps. Go to Settings > Writing page and under the update services section delete any URLs in the box (Normally you will only see one URL rpc.pingomatic.com). Now click on the Save changes button to store your settings.

      Try editing a post to see if this resolved your issue. If it didn’t then, please try steps in our WordPress troubleshooting guide.

      Admin

  29. Lisa Cox

    This article saved me so much time….I was ready to scrap the whole thing and re-do the blog from the start because I thought I had made an irreversible mistake. Two clicks everything is fixed – THANK YOU! Sorry, I didn’t mean to sound like Dr. Suess. Enjoy your day!

  30. Daulat khan

    Hi! This article was helpful but when i put my site on google search bar ex, ac-universal.com/wp-admin an error 404 found how can i enter into my word press.
    Guied ne thanks

  31. Mark Wayda

    Just wanted to say thanks. Simple and effective fix for a problem that had been perplexing me for a few days!

  32. joseph

    thank you, this was very helpful

  33. Khulu

    Thank you Tom

    Your solution works perfectly!!!!

  34. Ash

    Thanks. Your instructions worked 100%. It was driving me crazy.

  35. Okereke Divine

    Though my problem was that if i try to update my post., it redirects me to 404page.

    I followed your instructions and it worked perfectly!

  36. Collins

    I can’t access my home page.
    It keep saying 404 not found whenever i go to my url

  37. Fernando Njaria

    Thank you so much, had me going crazy with the 404 error, but after saving changes to the permalinks settings it worked!

  38. Ibrahim Shabbir

    I Cannot Even Access My Admin Page

    • Doni

      That is my problem also. I can access my home page and one of the two top-nav pages, but I can’t access the second page, and I can’t get to /wp-login or /wp-admin.

  39. Paulo

    Awesome… saved my life, thank you

  40. Tom

    Great tips – for some reason, this didn’t completely fix my issue as AllowOverride was set to ‘None’ in my httpd.conf file

    Should anybody else run into the issues, simply edit your Apache2 httpd.conf file located in one of these locations: /etc/apache2/httpd.conf. /etc/apache2/apache2.conf.

    Look for:

    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

    And replace with:

    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

    Hope this helps somebody!

    • Clinton

      Thank you Tom,
      I deployed a new site with Google One Click Deploy and missed some instructions about setting the AllowOverride All for the docroot directory. Your reply along with this article helped me get this working again. With AllowOverride set to None .htaccess files are ignored, so the directives to use make permalinks work, fail. In my case the config that I needed to edit was /etc/apache2/sites-available/wordpress.conf which had the directory of the wordpress install with the AllowOverride None set.

    • My Real Name

      Thank you sir. You are my hero right now. I looked at so many sites and not a single one of them mentioned this. It wasn’t even obvious from the apache manual, to the extent that I read that.

  41. Dipak Vasava

    Thank You very, problem solved. its working code.

  42. Simran

    Thanks a lot..nothing to say. It really helped me. You done a great work..Thank you so much

  43. Lagz

    Worked like a charm, Thanks!
    Contact form 7 Ajax was not working, giving me the feedback 404 error in console log.
    I did not suspect rewriting rules until I read this.
    Saving the permalink settings did the job!
    Thank you

  44. Favour

    am confused, at the .htacess what I saw there was 0644 not 660, how do I go about it.

  45. JP

    Thank you for posting this- it saved me a ton of time- Cheers!

  46. prabhat pandit

    very helpful information for me

  47. Richard

    Thank you very much!!

  48. Prabhat

    thank you very much. for a moment i felt all my work is gone. you saved me :)

  49. Sonja

    Thank you!!! This was an awesome guide. Made my evening a lot better!

  50. eriab nsereko

    Thx WPB team, it worked like charm and that’s why I really love this mighty site!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.