Custom Category Template for Custom Post Type
-
Created a custom post type. It works.
Added custom categories to it. They work.
The archive itself works with the link:
https://domain.com/my_customposts/Since I created:
archive-my_customposts.phpTried created:
taxonomy-custom_categories.php
category-custom_categories.phpAnd even:
taxonomy-my_customposts.php
category-my_customposts.phpUsing the custom category link inside the Dashboard that looks like this: https://domain.com/custom_categories/category1/
I get:
Error 404 Not FoundThe code in functions is as follows:
add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'my_customposts', array( 'labels' => array( 'name' => __( 'Custom Posts' ), 'singular_name' => __( 'Custom Post' ) ), 'public' => true, 'has_archive' => true, ) ); } add_action( 'init', 'build_taxonomies', 0 ); function build_taxonomies() { register_taxonomy( 'custom_categories', 'my_customposts', array( 'hierarchical' => true, 'label' => 'Custom Categories', 'query_var' => true, 'rewrite' => true ) ); }
What am I missing?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Category Template for Custom Post Type’ is closed to new replies.