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. Farid

    Thank you very much for precious article that is useful to fixed my website problem.. i always prefer your web solution regarding in problem in wordpress cms.

    Thank you..;.

    • WPBeginner Support

      You’re welcome, glad our guides have been helpful :)

      Admin

  2. Ben

    Just wanted to leave a thank you comment! Your guides on WordPress are second to none! I have learnt so much reading your blog and every time I Google a problem..I am looking for your website and that is where I will click! Great and simple instructions even on the most complicated WordPress issues…you are awesome! Thanks.

    • WPBeginner Support

      You’re welcome, glad you like our content and hope our guides continue to be helpful :)

      Admin

  3. David Naugle

    This totally worked! I just updated my PHP and dashboard and home pages was accessible but not any of my post pages.
    Thx

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  4. Vivian S.

    Thank You so much it saved my life! I had to move my WordPress website to a new server and it took me a whole day to fix everything. I wish WP had an easy way to do this. :)

  5. Gustavo

    Thank you guys, you’re AWESOME, ALLWAYS!

    • WPBeginner Support

      You’re welcome :)

      Admin

  6. Don Current

    I tried everything in the article with no success. What I ended up doing was choosing a different Permalink structure and saving it, and then going back to the structure I wanted and saving it. Then all was well.

    • WPBeginner Support

      Thanks for sharing the method that worked for you :)

      Admin

  7. James

    I accidentally deleted .htaccess file when doing 301 and got the 404 not found error. Your tutorial came to my rescue. Just by saving the permalinks and it worked. Thank you.

    • WPBeginner Support

      You’re welcome, glad our guide could help :)

      Admin

  8. Ivan

    Saved me! I am dealing with forces I cannot comprehend, and this explanation and tip was really helpful!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  9. Uwemedimo Usa

    Wow, I’m shocked at how fast this worked. I recently migrated my site from a subdomain to the root domain and none of my links were working. All I did was go to permalinks in settings and click “save changes.” That was all. Wow. And I was really scared I’d broken something. Thank you.

    • WPBeginner Support

      You’re welcome, glad we were able to help :)

      Admin

  10. DNNY

    What do you do if you cant even get into your WP
    dashboard

  11. Katie

    Hi, thanks for the tips. I still can’t seem to fix the error. Have reset Permalinks, installed a redirect plugin (doesn’t help if wanting to redirect to the homepage). I can’t work out how to alter the .htaccess and not really confident to do it. Any other suggestions?

  12. Fola

    Thanks You saved me a lot of hassles

    • WPBeginner Support

      You’re welcome :)

      Admin

  13. Jill

    THANK YOU for this post! I had a primary domain that I let go and needed to move two sites on my hosting plan…. 1 to the primary domain position and 1 to an addon domain position which was formerly a subdomain position. I broke a lot of stuff. With some logical thought, I got most of it all back… EXCEPT all the pages on the primary domain site couldn’t be viewed on the live site once you clicked on them or the menu links. The home page loaded beautifully, but when you clicked a post or link… the errors popped up. This trick resolved those issues… so THANK YOU again! You saved the day!

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  14. umesh

    I just change the permalink directly and it shows 404 error I couldn’t access my website it redirects me to another site which is not mine

    • WPBeginner Support

      You would want to reach out to your hosting provider to ensure your domain is set up properly and there isn’t any malicious code on your site.

      Admin

  15. faheem

    404 Not Found
    nginx/1.10.3 (Ubuntu)
    please give me solution for that

    • WPBeginner Support

      For nginx, at the moment you would want to reach out to your hosting provider and they should be able to assist.

      Admin

  16. Carene

    I’m busy building a website via wordpress & cpanel. I by accident deleted the url in my dashboard. Now I don’t get even access. Is their any way to fix it.

  17. Long Nguyen-Vu

    Just want to let you know that you’ve helped me save a lot of time searching.
    Thanks so much.

    • WPBeginner Support

      You’re welcome, glad our guide was able to help :)

      Admin

  18. Jim

    OMG I LOVE YOU
    updating the permalinks and all is gold
    THANK YOU

    • WPBeginner Support

      Glad our guide was able to help :)

      Admin

  19. Brandon G.

    Updating permalinks fixed my 404 errors. Thanks!

    • WPBeginner Support

      You’re welcome :)

      Admin

  20. Musthafa

    Updating the permalink worked perfectly. Thanks guys!

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  21. ami

    thanks its is working

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  22. Heather

    Simply saving changes in my permalinks did the trick. Thank you!

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  23. Ekemini Robert

    After saving changed for the permalink, it still returned the 404 error. Then I used the clear cache WP button at the top and the problem was solved.

    • WPBeginner Support

      Glad you were able to resolve the issue :)

      Admin

  24. Didar

    Thank you so much !

    • WPBeginner Support

      You’re welcome :)

      Admin

  25. Ashish Agarwal

    Thanks so much for this post. You are a lifesaver. Clicking ‘Save Changes’ on Permalinks under Settings did the job for me.

    • WPBeginner Support

      Glad our recommendation was able to help :)

      Admin

  26. Alex

    I have issues on 404 Page not found.
    I tried updating the permalinks but still not working and I also checked the .htacess file in our server and it’s the same on the above sample. But still not working.

    • WPBeginner Support

      You may want to reach out to your hosting provider to ensure there are no issues on their end that could be a part of the issue

      Admin

  27. Luiz Felipe

    This simple solution saved me! thanks!!!!!!!

    • WPBeginner Support

      You’re welcome :)

      Admin

  28. Steve Dzwonczyk

    The 2nd method worked for me (FTP and edit of the .htaccess file). Thank you very much.

    • WPBeginner Support

      You’re welcome, glad our recommendation was helpful :)

      Admin

  29. Pranesh

    Thank you very much

    • WPBeginner Support

      You’re welcome :)

      Admin

  30. Anas

    Thank you so much for this helpful tip. Was really bugging me a lot

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  31. Michelle Kwok

    thanks a lot.. it’s weird.. works at step one =)

    • WPBeginner Support

      You’re welcome, glad our recommendation was able to help :)

      Admin

  32. Steph

    This worked at step 1. Thank you!

    • WPBeginner Support

      You’re welcome, glad our guide could be helpful :)

      Admin

  33. Ishmael

    Many thanks, solved my problem.

    • WPBeginner Support

      You’re welcome, glad our guide was helpful :)

      Admin

  34. Shiraz

    This article helped me bring my website back on. Thank you.

    • WPBeginner Support

      You’re welcome :)

      Admin

  35. mariam

    Thanks for this post,it really solved my 404 error problems

    • WPBeginner Support

      Glad our recommendations were able to help :)

      Admin

  36. Tim

    Just a quick note to say thank you so much! I had just activated a CDN (learning as I go) and thought I had broken my site and went searching everywhere but here was the answer…phew!

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  37. Lou Sarmiento

    Hi!

    I’ve added the htaccess script, updated my wordpress but still I need to resave the permalinks. Any other solution?

    Thanks!

  38. Ayesha

    i have 404 error but cannot acces neither the site or the wordpress. how can you access wordpress admin to solve the problem??

  39. Nera

    Lifesaver! It worked! Flushing permalinks! Haleluja… THANKS!

    • WPBeginner Support

      Glad our recommendation could help :)

      Admin

  40. wajid virk

    on clicking save changes my problem Resolved, WP beginner is a part of my journey to learn WordPress more and more.

    • WPBeginner Support

      Glad we can be here to help :)

      Admin

  41. Safa

    You just saved me, Thanks :D

    • WPBeginner Support

      You’re welcome :)

      Admin

  42. Nora

    Thank you so much! This saved our corporate website :D

    • WPBeginner Support

      Glad our article was helpful :)

      Admin

  43. Mary Ann

    Will it work in 404 error of Wordpress Multisite once I visit the admin dashboard of the sub-sites?

    • WPBeginner Support

      It would depend on the source of the error but this can certainly be one solution.

      Admin

  44. beginner

    Thank you, it solved the issue straight away!

    • WPBeginner Support

      Glad our article could help :)

      Admin

  45. Civali

    .htaccess example worked for me, tks!

    • WPBeginner Support

      Glad our recommendation could help :)

      Admin

  46. Vishwajeet

    So I checked all solutions and comments. I have same issue with a twist. I can see the pages when I am changing it to use the Page ID but not when I am selecting the Post-Name? Any solution to this? I know its weird.

    • WPBeginner Support

      You may want to delete the current htaccess file and if that does not fix the issue, reach out to your host to ensure there isn’t an underlying error causing the problem.

      Admin

  47. Mireille

    Hello,
    I just wanted to let you know that your website is of such great help ! I built my first Wordpress website and I managed to resolve many issues thanks to your articles. Thank you !

    • WPBeginner Support

      Thank you, glad our articles have been helpful :)

      Admin

  48. Benson Kanyi

    Hello Guys,

    I have been facing this issue for the last three days after migrating a new site from my localhost to an online CPanel server. Having tried a million and one option from various forums, none of them could work at all. The only solution that seems to work is disabling Mod_Security in the CPanel. I just did it and it works like a champ. Thanks

    • WPBeginner Support

      Thanks for sharing the solution that worked for you :)

      Admin

    • hüseyin

      I worked for days. It happened. cpanel mod security disable. solved the problem. Thanks BENSON

  49. Christopher

    Worked! Thanks!

    • WPBeginner Support

      Glad our recommendation worked for you :)

      Admin

  50. Peter

    you blog saved me from disaster thanks so much. im learning so much now

    • WPBeginner Support

      Glad our recommendation could help :)

      Admin

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.