• Resolved laptopsticker

    (@laptopsticker)


    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.php

    Tried created:
    taxonomy-custom_categories.php
    category-custom_categories.php

    And even:
    taxonomy-my_customposts.php
    category-my_customposts.php

    Using the custom category link inside the Dashboard that looks like this: https://domain.com/custom_categories/category1/

    I get:
    Error 404 Not Found

    The 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.