How to Fix WordPress Posts Returning 404 Errors

Are you experiencing return 404 errors when accessing the WordPress admin area and blog? When trying to open a post, you see "404 Not found" prompt is where this error occurs.

图片[1]-如何修复 WordPress 帖子返回 404 错误-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

Why does my WordPress post return a 404 error?

WordPress post showing 404"Page not found"There are various reasons for errors. The common ones are:

  • Plugin or theme conflicts:Sometimes, on the websiteInstalled plug-insmaybethematicMay interfere with the way WordPress handles fixed links. This could lead tolink interruptionrespond in singing 404 ErrorThe
  • Custom code issues:If custom code is added to a site, there may be errors in the code that affect fixed links or cause other conflicts that can lead to 404 errors on posts.
  • Problems with .htaccess files: The .htaccess file is important in constructing URLs in WordPress. If this file is corrupted or missing, it may result in a 404 error for the post.

Let's see how to fix a WordPress post that returns a 404 error.

Method 1: Check for plugin or theme conflicts and custom code issues

Sometimes adding to a WordPress site'sPlugins, ThemesmaybeCustom CodeIt may interfere with the fixed link or cause a conflict, resulting in a 404 error. This is a problem that we have encountered many times in our own operations.

The solution to this problem is to temporarily disable the plugin. Plugins sometimes break the way WordPress handles links.

After deactivating the plug-ins, reactivate them one by one, while checking that activating each one of them404 error again. If an error occurs after activating a particular plugin, it is that plugin that is causing the problem.

Usually we find a plugin with similar functionality to replace it, or we can search for solutions related to that plugin or contact the plugin developer for help, a process that can be time consuming.

Similarly, WordPress themes can cause conflicts.

To perform the check, you canTemporarily switch to the default WordPress themeFor example, Twenty Twenty-Three or Twenty Twenty-Four. go toexterior condition " thematicand then click on the default theme on the "activate"It'll be fine.

激活默认 WordPress 主题

When using the default theme 404 error disappears, then it indicates a conflict with the current theme. Try troubleshooting the theme or consider using a different theme.

If a code snippet has been inserted into your website, there may be an error in the code that is causing a 404 error. Take a close look at the added code and see if you can identify any errors.

The safest way to add code snippets to WordPress is to use theWPCodePlugin. This plugin inserts custom code without the need to use the theme files directly, thus reducing the risk of site crashes.

In addition, whenever WPCode finds an error in the code, it automatically deactivates the code snippet and asks to check it. It is also possible to use test mode to check if the code works before pushing it to your site.

WPCode 错误警告

If none of these solutions work, go ahead and troubleshoot the fixed link settings.

due to .htaccess fileThere is an issue with the rewrite rules in WordPress posts that may return a 404 error. In most cases, the problem can be fixed by updating the fixed link settings.

Simply go to the WordPress admin backend in theSetting "Fixed Linksand then click on "Save Changes"Button.

检查固定链接

There is no need to change the fixed link settings themselves. This will update your fixed link settings and refresh the rewrite rules.

In most cases, this solution will fix WordPress post 404 errors. However, if it doesn't work, then you need to manually update the .htaccess fileThe

Method 3: Update WordPress .htaccess file

Still the same, before you start, backup the WordPress .htaccess file. If something goes wrong, you can easily restore the original fileThe

Now, connect to your server using an FTP client such as FileZilla or the File Manager app in your WordPress dashboard.

Next, find and edit the.htaccess fileThe file is located in the same location as the /wp-content/ respond in singing /wp-includes/ etc. in the same location as the folder.

Simply right-click on the file and select "file permissions"Just do it.

.htaccess 文件权限

Files can be made writable by changing the file permissions to 666.

Simply add the following to the "numerical value"box and type "666"and then click on "recognize"Just do it.

将 .htaccess 文件的文件属性更改为 666

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

It is also possible to edit the file and add code to it.

编辑 .htaccess 文件

After opening the .htaccess file with a text editor, insert the following code:

图片[8]-如何修复 WordPress 帖子返回 404 错误-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

Method 4: Fix WordPress Posts Returning 404 Errors on Local Server

If you are using a local server for testing purposes, you 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 404 errors for posts and pages on your local server.

The operation method varies depending on the platform used. UseXAMPPusers can open the Control Panel and click "configure" button. Then select the "Apache (httpd.conf)".

XAMPP 上的 Apache(httpd.conf)菜单

Next, find this line#LoadModule rewrite_module modules/mod_rewrite.so and delete "#" to cancel the comment.

This will load mod_rewrite.

在 httpd.conf 文件上查找 rewrite_module

Then, all instances foundAllowOverride None and change it toAllowOverride AllThe

"full" value means that all instructions can be overridden.

将 AllowOverride None 更改为 AllowOverride All

When you are done, you can save the httpd.conf file and close it. After that, in the XAMPP control panel, click "cessation", and then click again on "activate (a plan)"Reboot it.

Then, return to your admin dashboard to see if your fixed links are working properly.

I hope this article will help you to resolve the post that returns 404 error in WordPress.


Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by Harry
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments