The simple cure if a Wordpress custom content type doesn't display, but gives a 404 page not found

Topics: 

wordpress-logo-stacked-rgb.pngSometimes custom content types stop displaying, on a Wordpress site. In my case, my server had been hacked and everything wiped, so much so that I didn't have a proper database backup but instead raw MySQL data files from which to restore the site. After restoring the website, everything was functioning EXCEPT pages from a custom content type for a plugin I'd coded. Every page I checked, instead of displaying, gave a page not found error (404 error code). Immediately before the hack this custom content type worked perfectly, and some of the most popular pages on LongTailPipe were implemented with this custom content type.

Searching the Internet didn't turn up much. Some were discussing which template files to use. That would be the thing to check while developing the custom content type. But, I'd already made it past that consideration, because the code had been written months ago and was already well tested.

But, I saw a comment on one such posting: Go to the Permalinks settings and click SAVE.

I did, and presto the custom content type pages started working perfectly.

Process:

  • In the Wordpress dashboard - navigate to Settings / Permalinks
  • Click Save

That's it.

Apparently doing so will update your permalinks settings and flush rewrite rules. I suppose the process of bringing my site back to life caused unwanted changes in the rewrite rules. Initially Wordpress decided to disable some things because two plugins (including this one) were missing.