Custom Post Type relationship with hierarchical parent and child permalinks
Custom Post Type relationship with hierarchical parent and child permalinks
Custom Post Type relationship with hierarchical parent and child permalinks
Attachment page 404 not found when image is attached to post
Add ‘articles’ prefix before blog posts url without affecting pagination
rewrite_rule for custom post type doesn’t affect get_permalink
Add parent/child taxonomy to custom post type url
Using ‘Primary Category’ in URL
Thanks to Milo’s help the code in the question ended up working: permalinks fixed and the structure stayed exactly how I wanted it described in the question above. Removed the rewrite_rules_array hook entirely Moved my taxonomy registration above my post type registration Changed the taxonomy to be non-hierarchical ‘hierarchical’ => false From my limited understand … Read more
With helpful tips from Milo, I was able to remove the taxonomy slug when no taxonomy is assigned to the custom post type by adding the following code to the updated functions above: add_filter( ‘request’, ‘project_request_filter’ ); function project_request_filter( $request ){ if( array_key_exists( ‘project’ , $request ) && ! get_term_by( ‘slug’, $request[‘project’], ‘project’ ) ){ … Read more
It turns out that, I was using “year” as a custom taxonomy, which was part of the reserved terms of WordPress!!! With using the reserved term, it will return the 404 error for the top level pages, hence the redirection to the home page. !!! Listed here: https://codex.wordpress.org/Function_Reference/register_taxonomy#Reserved_Terms
Please place below code in your theme’s functions.php file & let me know how it goes 🙂 add_action(‘wp’, function(){ list($uri, $qs) = explode(‘?’, $_SERVER[‘REQUEST_URI’]); if ( $uri == “/arbitrary/path” ) /* Change this to path that you want to match*/ { locate_template( “template-full-width.php” , true, false ); /* Don’t forget to replace template name with … Read more