I am not sure what I am missing here , the cpt archive page simply does not want to show. I reset permalinks ( currenlty on default ) , copied archive.php and renamed to archive-articles.php ( tested anything I could think of ) but the custom template does not want to show. It loads default archive.php. Testing on twentyseventeen. The single-article.php worked out of the box but not the archive.

 * Add custom taxonomy for Articles *

add_action('init', 'articles_categories_register');

function articles_categories_register() {
$labels = array(
    'name'                          => 'Articles Categories',
    'singular_name'                 => 'Articles Category',
    'search_items'                  => 'Search Articles Categories',
    'popular_items'                 => 'Popular Articles Categories',
    'all_items'                     => 'All Articles Categories',
    'parent_item'                   => 'Parent Article Category',
    'edit_item'                     => 'Edit Article Category',
    'update_item'                   => 'Update Article Category',
    'add_new_item'                  => 'Add New Article Category',
    'new_item_name'                 => 'New Article Category',
    'separate_items_with_commas'    => 'Separate articles categories with commas',
    'add_or_remove_items'           => 'Add or remove articles categories',
    'choose_from_most_used'         => 'Choose from most used articles categories'

$args = array(
    'label'                         => 'Articles Categories',
    'labels'                        => $labels,
    'public'                        => true,
    'hierarchical'                  => true,
    'show_ui'                       => true,
    'show_in_nav_menus'             => true,
    'args'                          => array( 'orderby' => 'term_order' ),
    'rewrite'                       => array( 'slug' => 'articles', 'with_front' => true, 'hierarchical' => true ),
    'query_var'                     => true

register_taxonomy( 'articles_categories', 'articles', $args );

 * Add custom post type for Articles *

add_action('init', 'articles_register');

function articles_register() {

    $labels = array(
        'name' => 'Articles',
        'singular_name' => 'Article',
        'add_new' => 'Add New',
        'add_new_item' => 'Add New Article',
        'edit_item' => 'Edit Article',
        'new_item' => 'New Article',
        'view_item' => 'View Article',
        'search_items' => 'Search Articles',
        'not_found' =>  'Nothing found',
        'not_found_in_trash' => 'Nothing found in Trash',
        'parent_item_colon' => ''

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'has_archive' => true,
        'rewrite' => array( 'slug' => 'articles', 'with_front' => true ),
        'capability_type' => 'post',
        'menu_position' => 6,
        'supports' => array('title', 'excerpt', 'editor','thumbnail') //here you can specify what type of inputs will be accessible in the admin area

    register_post_type( 'articles' , $args );
  • can you clear something up? You say that the single is working but not the archive. Your code shows the CPT is "articles" but by that name, single should NOT be working and the archive should... I usually pluralize everything. Also i would add a namespace identifier. ie change the register cpt to 'benn_articles' or something and then both archive-benn_articles.php and single-benn_articles.php. Make sure to flush permalinks after you do this.
    – rudtek
    Commented Jan 23, 2017 at 21:05
  • If you are on localhost then try to rename the file again write all the text yourself. There is some bug in win10 when I copy files I can delete the "- copy" and have the same name a without limits... and the file archive-articles.php not loading to me too until I renamed it and write all his name manually.
    – Shibi
    Commented Jan 24, 2017 at 0:10
  • @rudtek tried everything , flushing, renaming , underscores , nothing worked .
    – Benn
    Commented Jan 24, 2017 at 19:42
  • 1
    I'll test on my end. Give me a few
    – rudtek
    Commented Jan 24, 2017 at 19:45
  • @Shibi yes localhost , and just tried your suggestion, same thing
    – Benn
    Commented Jan 24, 2017 at 19:47

1 Answer 1


I set my system up with the exact same as your code above. I get the same results. What I did to fix it was change your line

    'rewrite' => array( 'slug' => 'articles', 'with_front' => true ),


    'rewrite' => array( 'slug' => 'articles2', 'with_front' => true ),

and then to

    'rewrite' => array( 'slug' => 'articlis', 'with_front' => true ),

and everything loaded fine on the last 2 options. It looks like maybe there is perhaps a built-in usage of articles already so that when you re-write to "articles" wordpress isn't sure what to do. I don't have an explanation for it.

What I would suggest all the same is use a CPT name more specific than what you are currently using.

Instead of articles, can you use a name that is actually what the post will represent? Changing

  • what I just found is that is actually custom tax so is looking for, taxonomy-articles_categories, I would prefer archive-articles.php rather . Yes I can change it to anything , actually just testing the CPT
    – Benn
    Commented Jan 24, 2017 at 20:31
  • try changing like above. Make sure to flush permalinks between. I think you'll see it works.
    – rudtek
    Commented Jan 24, 2017 at 20:41
  • could you mark the answer?
    – rudtek
    Commented Jan 25, 2017 at 22:14
  • this did not work for me . Here try this complete CPT please wordpress.stackexchange.com/questions/253995/… taxonomy-docs-category works but not archive-docs-category or archive-anything
    – Benn
    Commented Jan 26, 2017 at 8:16
  • That appears to be a different issue. I'll look at it though. I double checked again with the code above it solves your issue though. Can you please double check (including flushing permalinks?)
    – rudtek
    Commented Jan 26, 2017 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.