Custom Post Type 404 you say?
After moving my WordPress install out of a directory and turning it into a Multisite install, I found the problem that my Portfolio (which is based off a couple of Custom Post Types, vanished without a trace. I wasn’t aware of this until today and I’ve only just come out of panic mode. Heres what I did:
- In the WordPress Admin, go to Settings > Permalinks. Just by going here, apparently this flushes or rewrites permalink rules.
- Failing that, you have a more serious problem. Add the following section of code to your functions.php file, refresh your Admin Dashboard once, and then remove the code.
1 2 3 4 5 | add_action('admin_init','my_admin_init'); function my_admin_init() { global $wp_rewrite; $wp_rewrite->flush_rules(); } |
add_action('admin_init','my_admin_init');
function my_admin_init() {
global $wp_rewrite;
$wp_rewrite->flush_rules();
}Note: This is very performance heavy function. I waited nearly 5-10 seconds when I refreshed my Admin Dashboard. As I said, you should remove it afterwards.
No Responses