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)

There’s nothing quite as frustrating as clicking on a post you know exists—only to land on a 404 error page. We’ve run into this issue more than once, and it can feel confusing when nothing seems obviously broken.

The good news? In most cases, you can fix it in under a minute. Just go to Settings » Permalinks and click ‘Save Changes’—that simple step resolves the issue for the majority of WordPress sites.

If that doesn’t work, don’t worry. We’ve put together a step-by-step guide covering every common cause… from plugin conflicts to .htaccess issues so you can get your posts back online fast.

How to fix WordPress posts returning 404 error

Why Are My WordPress Posts Returning a 404 Error?

A 404 error means the server couldn’t find the page you requested—even though it may exist in your WordPress dashboard. This disconnect usually happens because something has broken the link between your post’s URL and its actual content.

Here are the most common reasons your posts might show a 404 “Page Not Found” error:

  • Plugin or theme conflicts: Some plugins or themes can interfere with how WordPress handles permalinks. This can lead to broken links and 404 errors on posts that were working fine before.
  • Custom code issues: If you’ve added custom code to your site, even a small error can affect permalinks or cause conflicts that result in 404 errors.
  • Problems with your .htaccess file: The .htaccess file controls how WordPress structures URLs. If this file is corrupted, missing, or misconfigured, your posts and pages may return 404 errors.

How to Find All WordPress Posts With 404 Errors

Before jumping into fixes, it helps to know if this error affects just one post or many. Understanding the scope makes it easier to choose the right solution.

We recommend using Google Search Console. If you haven’t set it up yet, see our guide on how to add your WordPress site to Google Search Console.

Once the Google bot has crawled your site, Search Console will show you detailed reports—including any 404 errors it finds.

To see which posts are returning errors, log in to your Search Console dashboard. Navigate to the ‘Pages’ report, and you’ll find a list of all flagged URLs.

Google Search Console Pages Report

For more help, check out our tips for using Google Search Console to grow website traffic, which includes advice on fixing 404 errors.

Now, let’s look at how to fix WordPress posts returning 404 errors. You can use the links below to jump to a specific method:

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

Plugins, themes, or custom code can sometimes interfere with permalinks and cause 404 errors. We’ve run into this ourselves when testing tools on our demo sites.

When we troubleshoot, we use a staging environment to safely deactivate plugins one by one. This helps us isolate the problem without affecting the live site.

To try this yourself, start by temporarily deactivating all your plugins. Then reactivate them one at a time, checking after each one to see if the 404 error returns.

If the error appears after activating a specific plugin, that’s likely the cause. You can search for solutions related to that plugin or contact the developer for support.

Your WordPress theme could also be the issue.

To check, temporarily switch to a default WordPress theme like Twenty Twenty-Three or Twenty Twenty-Four. Go to Appearance » Themes and click ‘Activate’ on a default theme.

Activating a default WordPress theme

If the 404 error goes away with a default theme, your original theme is probably causing the conflict. You can troubleshoot it further or consider switching to a different theme.

For recommendations, check out our expert pick of the most popular WordPress themes.

If you’ve recently added code snippets to your website, review them carefully. Even small mistakes can cause 404 errors.

We recommend using the WPCode plugin for adding custom code. It lets you insert snippets without editing theme files directly, which reduces the risk of breaking your site.

WPCode also detects errors automatically. If something goes wrong, it deactivates the snippet and alerts you. You can even use testing mode to check your code before pushing it live.

WPCode error warning

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

WordPress posts often return 404 errors because of problems with rewrite rules in your .htaccess file. In most cases, you can fix this by simply resaving your permalink settings.

Go to Settings » Permalinks in your WordPress admin and click the ‘Save Changes’ button.

Check Permalinks

You don’t need to change anything. Just clicking ‘Save Changes’ flushes the rewrite rules (meaning WordPress regenerates the URL routing instructions that tell your server where each post lives).

This simple step fixes the 404 error for most WordPress sites. If it doesn’t work for you, you may need to update your .htaccess file manually.

Method 3: Update the WordPress .htaccess File

Before making any changes, we recommend backing up your WordPress site and your .htaccess file. If something goes wrong, you can easily restore the original.

You’ll need to connect to your server using an FTP client like FileZilla, or use the File Manager in your hosting control panel.

Next, find the .htaccess file (a hidden configuration file that controls how your server handles URLs) in your site’s root folder. This is the same directory that contains folders like /wp-content/ and /wp-includes/.

Right-click on the file and select ‘File permissions’ or ‘Change permissions’ from your FTP client.

.htaccess file permissions

If WordPress couldn’t write to the file before, try changing the permissions temporarily to 666 to make it writable.

Important: Permission 666 means anyone can read and write to the file, which is a security risk. Only use this setting temporarily and change it back immediately after you’re done.

Now, return to your WordPress admin and resave your permalink settings (Settings » Permalinks » Save Changes). This lets WordPress regenerate a proper .htaccess file.

Once that’s done, go back to your FTP client and change the file permissions to 644. This setting allows WordPress to read the file while protecting it from unauthorized changes.

Change file attributes for the .htaccess file to 644

Alternatively, you can edit the .htaccess file manually.

Right-click on the .htaccess file and select the View/Edit option.

Edit .htaccess file

The file will open in a plain text editor like Notepad or TextEdit.

Add the following default WordPress rewrite rules:

# 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

Save the file and upload it back to your server. Then check if your posts are loading correctly.

Method 4: Contact Your Hosting Provider

If none of the solutions above have fixed the 404 error, we recommend contacting your WordPress hosting provider.

There may be a server-side issue on their end, or they can help you troubleshoot the problem further. In our experience, good hosting support teams can often spot configuration issues that are easy to miss.

For tips on getting help, see our guide on how to properly ask for WordPress support and get it.

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

If you’re running WordPress on a local server for testing, you’ll need to enable mod_rewrite in your Apache configuration. This applies to MAMP, WAMP, or XAMPP setups.

Enabling mod_rewrite allows WordPress to generate clean URLs and prevents 404 errors on your local posts and pages.

The steps vary by platform. If you’re using XAMPP, open the control panel and click the ‘Config’ button in the Actions column. Then select ‘Apache (httpd.conf)’.

The Apache (httpd.conf) menu on XAMPP

Find this line: #LoadModule rewrite_module modules/mod_rewrite.so

Remove the ‘#’ at the beginning to uncomment it. This enables the mod_rewrite module.

Finding the rewrite_module on httpd.conf file

Next, look for lines that say AllowOverride None and change them to AllowOverride All. This tells Apache to allow .htaccess files to control URL routing.

You’ll typically find these inside <Directory> blocks, especially the one pointing to your site’s folder (like htdocs in XAMPP). For local testing, it’s usually safe to apply this change wherever you see it.

Changing AllowOverride None to AllowOverride All

Save the httpd.conf file and close it. In the XAMPP control panel, click ‘Stop’ on the Apache module, then click ‘Start’ again to restart it.

Now go back to your WordPress admin dashboard and check if your permalinks are working.

Video Tutorial

If you prefer visual instructions, watch the video below.

Subscribe to WPBeginner

Frequently Asked Questions About WordPress 404 Errors

Running into 404 errors on your WordPress site can be confusing. Here are answers to common questions that can help you troubleshoot more effectively.

Why am I getting a 404 error on my WordPress posts?

A 404 error on WordPress posts usually means the server can’t find the page at the requested URL. This can happen due to broken permalinks, a corrupted .htaccess file, deleted posts, or a plugin/theme conflict that changes how URLs are handled.

How do I fix a 404 error in WordPress?

The fastest way to fix a WordPress 404 error is to resave your permalink settings. Go to Settings » Permalinks and click ‘Save Changes’. If that doesn’t work, check your .htaccess file, disable plugins, or switch to a default theme to rule out conflicts.

How can I find all 404 errors on my WordPress site?

Google Search Console is the best way to find 404 errors on your WordPress site. It shows you a list of all 404 errors that Googlebot encounters. You can also use plugins like Broken Link Checker to spot broken links and missing pages.

What does the .htaccess file do in WordPress?

The .htaccess file in WordPress is a configuration file that controls how URLs are processed. WordPress uses it to manage permalink structure and route URLs to the correct content. If this file is missing or corrupted, your URLs may stop working correctly.

How do I safely edit the .htaccess file?

You can safely edit the .htaccess file using an FTP client or your hosting file manager. Always create a backup first. After editing, make sure the permissions are set to 644 so it stays readable and secure.

Why do my WordPress category or tag pages show 404 errors?

WordPress category or tag pages may show 404 errors if your theme doesn’t support archive templates or if permalink settings are misconfigured. Resaving permalinks and checking your theme’s archive support can usually fix this issue.

How do I fix 404 errors for custom post types?

To fix 404 errors for custom post types, go to Settings » Permalinks and click ‘Save Changes’ to refresh rewrite rules. Also check that your custom post type is registered with the correct rewrite settings and has archive support if needed.

Can I redirect 404 pages to my homepage or another page?

Yes, you can redirect WordPress 404 pages using plugins like Redirection. This lets you create 301 redirects from old or broken URLs to new ones. You can also create a custom 404 page to guide users back to useful content.

🎁 Bonus: Additional Guide on Handing 404 Errors

Here are more resources we’ve put together to help you manage 404 errors and other common WordPress issues:

We hope this article helped you fix WordPress posts returning 404 errors. 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.

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. I unpublished some posts from my site and I have linked some internal links to the posts, pls, how can I redirect the posts url to the homepage instead of showing “page not found”

  2. I get the 404 error on posts I have deleted and do not wish to redirect them to other articles. How do I solve that?

    • In that case you would want to redirect the posts to your homepage as that URL would show a 404 error if there is nothing to show.

      Admin

      • This looks so simple yet very helpful. I’ve never even considered that alternative before. I’ll do that right away. Thanks a million!

  3. This is one of the most occuring error for wordpress websites.
    this is really frustrating as it seems to get stuck and leading to nowhere.
    I have solved the issue by saving the permalink.
    I didn’t know about the other steps.
    I really appreciate the efforts to make it holistic by including all the steps to resolve this error.

  4. Hello. The 404 error can be really frustrating, and we’ve all encountered it at least once. The situation becomes challenging when everything appears to be correct, there are no broken links, yet the 404 error persists. I faced this issue once, and it was resolved by adjusting the permalink settings.

  5. Hi
    in my case, a plugin named as “WebP Express” create a htaccess file in uploads folder that restrict my access to some images.
    try rename or remove it and see if the problem still exist.

  6. Syed & the team u saved my whole entire day! My homepage was actually loading well.. but the other pages couldn’t load. So, I pasted the code in my .htaccess file and it did absolutely like magic.

    # BEGIN WordPress

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

    # END WordPress

  7. Thanks – None of the suggested solutions did work for me. Looks like the typical permalink error but it isn’t.

    Saving permalink again does not create a new .htaccess.

    • If none of the methods in our guide are working for you, please reach out to your hosting provider and they should be able to help fix the issue.

      Admin

  8. Thank you for this post. I was missing the .htaccess files after moving sites and of course the wordpress code in them. I’ve replaced it all and voila! We are live at 5. Thanks.

    • If none of the recommendations from our guide could solve your error, please reach out to your hosting provider and they should be able to take a look and help!

      Admin

  9. Hi,
    saving permalink helped me too, but it keeps returning over and over again after some days.
    I have no clue what causes it.

    • If it is a constantly recurring error, we would recommend reaching out to your hosting provider and they can either look at their error logs for the site or keep an eye on your site for the specific error causing the problem.

      Admin

  10. This is my lifesaver. My site is working fine after modifying the .htaccess files.
    Thanks a ton!

  11. For me the problem was I forced a redirect from mydomain.com to ww.mydomain.com, but in wordpress the site URL said mydomain.com. After changing the redirection to ww.mydomain.com -> mydomain.com everything worked.

  12. I was panicking and thinking that my website was hacked or had malware. As I read your writing and you wrote not to worry, I began to relax. The first option (permalink) worked for me immediately…
    Thanks :-)

  13. On IIS there is no .htaccess file but the key is still the permalink settings. Just hitting Save didn’t fix it but changing the Custom Structure to Plain worked like a charm. Thanks for the push in the right direction.

    • Thanks, Max, none of the solutions here worked and I’m on IIS as well. I changed my permalinks from post name to plain and it worked.

  14. Dang! Can’t thank you enough for this – super simple fix worked perfectly – just hit save changes on the permalinks settings page and viola’ – my pages are back. Thank you!!

  15. honestly thank you so much! without fail your site always comes thru with answers that work. thank you so much!
    (now I just wish I knew what caused it to get out of whack in the first place. oh well.)

  16. This article just saved me from a panic attack Lol. The solution worked great. Thanks for making this video.

    • If none of our methods in this guide worked for you, we would recommend reaching out to the support for your hosting provider to ensure there is not an error on their end.

      Admin

  17. None of the above suggestions worked so I did some further searching. I came across someone who suggested switching off the mod security under the security section in cpanel.

    I tried this and it worked. I also tested it by switching it back on after a change and then trying another change and BAM, 404 error.

    • Thanks for sharing this should someone else run into this issue. Not every host allows access to that specific file but if you reach out to your host they can normally disable or change it for you :)

      Admin

    • Disabling ModSecurity fixed mine.
      I actually tried permalinks plus rewriting .htaccess, but that didn’t solve my problem. I’m glad I read comments. Many thanks guys for sharing.

  18. Thanks, it was so simple and the problem solved. No other pages were visible after I migrated to another server. I added the lines to .htaccess file and uploaded the same. Now all the pages are being displays without the 404 error and I am able to access my WP dashboard too. Thanks a lot.

  19. My posts are showing 404 error after installing ssl certificate. How can I fix it? I tried everything mentioned above, but none helped.

  20. My .htaccess file is exactly the same with that code but nevertheless I did whatever in the post. did not work, saved permalinks through admin console, did not work. Manually edits, no luck. Deleted the .htaccess and recreated it by saving it from admin console, again did not work. Nothing works. Don’t know how did it even work on others?

    • If none of the recommendations from our article were able to help we would recommend reaching out to your hosting provider as that can be a sign that there is an issue on your host’s end.

      Admin

  21. You saved my day. I got this issue after transferring my site from one hosting to another. I couldn’t believe it was so simple to fix the issue. Many Thanks WpBeginner team!

  22. I never reply to these things but just wanted to jump on here and say thank you! I’ve been having this issue a lot and having to wait ages for support to help me and so finally had a hunt around, found this, and can now fix it myself. You legend!! Much appreciated

  23. One of solutions to correct the issue with the Permalink change is simply delete the .htaccess file – Wordpress will recreate it again automatically.
    But, before you delete it, copy the file on your computer, just in case…

    • If someone has customized their htaccess file then that would be a good idea. Otherwise, WordPress should auto regenerate the default information in the file where most wouldn’t need to worry.

      Admin

  24. Saving the permalinks settings worked perfectly. Such a simple solution to what looked like a serious problem! Thank you!

  25. I’m facing 404 error while adding new plugin , theme , editing any post or product, editing any page ..
    I’ve try to save permalinks and also tried to change .htaccess .. But not this given solution is working for me.

    • You would want to reach out to your hosting provider to see if you are running into any errors on their server’s end.

      Admin

    • You would use the htaccess method from this guide or reach out to your hosting provider to be able to assist you

      Admin

    • For that specific error, you would want to reach out to your hosting provider to take a look.

      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.