Custom Post 404

Ok all, I think I figured out the problem…well, problemS. First, credit to @WebElaine, for putting me on the right track with the unregister_post_type() function. I unregistered ALL of my post types, then went through and made sure everything was singular with no trailing S. After unregistering everything (and commenting out any code that would … Read more

Which filter/action should I use to serve content for “virtual” files

I think the earliest actions you can hook are muplugins_loaded and plugins_loaded. muplugins_loaded will only fire for Must Use Plugins. Some plugins_loaded pseudo-code: add_action( ‘plugins_loaded’, ‘wpd_plugin_routes’ ); function wpd_plugin_routes() { if( is_a_virtual_file() ){ serve_file(); exit; } } If you want the full WordPress environment, plugins, theme, and authenticated user, right before WordPress parses the request, … Read more

How to filter a custom post type by custom taxonomy without 404

When you want to use a taxonomy inside a custom post type URL hierarchy, you have to register it BEFORE the custom post type. Otherwise it won’t work properly. here is a short example: function so305901_register_taxonomies() { $args = [ //your settings ]; register_taxonomy( ‘taxonomy_slug’, [‘custom_post_type_slug’], $args ); } add_action( ‘init’, ‘so305901_register_taxonomies’ ); function so305901_register_custom_post_types() … Read more

Migrated site – Images have 404 error

It looks like your localhost site had WordPress installed in the root directory but your production site is in a sub-directory. You should review the instructions in the the WordPress Codex for Moving WordPress to see if you missed any steps. It describes both moving a WordPress installation from one server to another, and moving … Read more

Custom post type slug 404

You are missing with_front in rewrite which is true by default. Change it to something like this ‘rewrite’ => array( ‘slug’ => ‘apps’, ‘with_front’ => false, ) See the docs 💡 Bonus tip: You should avoid using flush_rewrite_rules() there, it’s quite heavy and affects performance. You should ONLY use it when modifying rewrite_rules outside of … Read more

404 on internal pages, in all sites in my local server

This can be related to your overall Apache configuration and have nothing to do with WordPress itself. By default, Apache will not load any custom .htaccess files, you need to set AllowOverride for the given directory like so <Directory /path/to/site> AllowOverride FileInfo # etc </Directory> FileInfo should suffice, if not, try All and check the … Read more

404 Not found error after update to WordPress 5.0

First I tried to disable all plugins and change theme to the default WordPress theme and error is showing yet. Then tried to install a new WordPress 5.0.1 and got 2 errors: theme.min-rtl.css:1 Failed to load resource: the server responded with a status of 404 (Not Found) style.min-rtl.css:1 Failed to load resource: the server responded … Read more