My website has started generating 404 pages, and now there are more than a thousand 404 pages like so:


... (and so on)

I had installed a custom 404 plugin, and the problem started immediately after that. I have deactivated that plugin now. (I am not sure if the plugin started the problem in the first place, so am avoiding naming the plugin here.)

I was wondering if I should directly delete the pages via the database. It that advisable?

  • Why not delete them if you don't want them :) ? It's better to do it through WordPress with a script or Admin Panel. In admin panel you can choose how many pages to be shown so you can delete for example 100 per time. If your pages do not have a custom field or a category maybe is safe to delete them directly via the database.
    – Laxmana
    Commented Apr 27, 2017 at 7:02

1 Answer 1


No, do not delete the pages. That will not solve your problem. What you need to do is fix your permalink settings. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. Chances are the 404 plugin is was the culprit here.

You should flush your permalinks. Go to Settings => Permalinks, and click on the Save Changes button.

enter image description here

This will update your permalinks settings and flush rewrite rules. In most cases, this solution will fix the problem. However, if it does not work for you, then you probably need to update your .htaccess file manually.

  • He said that he want to delete those pages. How deleting them would not solve his problem ?
    – Laxmana
    Commented Apr 27, 2017 at 7:03
  • @Najeeb Do these pages have any value? Or are they just blank pages created by the plugin. If the pages are worthless just delete them. To quickly remove them from the WordPress dashboard change the posts per page setting to something like 200 and then select all posts and bulk delete. Then repeat until all are deleted. See here, dropbox.com/s/c2xf1ij0hodhqa0/…
    – Joe Dooley
    Commented Apr 27, 2017 at 7:08
  • @JoeDooley, strangely, these pages were just 404 pages with permalinks as I described in my question. And they were displaying the standard 404 error. AFAIK, they were not actual HTTP 404 errors, only pages displaying a 404. And they were getting spawned very rapidly. I don't know if my site got hacked owing to some vulnerability in the plugin.
    – Najeeb
    Commented Apr 28, 2017 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.