I'm extending the Fall Wordpress theme by using my own child theme. One of the things I'm trying to do is to make an archive page for the 'service' custom post type. That type is defined in the parent theme code like this:

register_post_type('service', array(
 'labels' => $labels,
 'singular_label' => __('service'),
 'public' => true,
 'show_ui' => true, // UI in admin panel
 '_builtin' => false, // It's a custom post type, not built in!
 '_edit_link' => 'post.php?post=%d',
 'capability_type' => 'post',
 'hierarchical' => false,
 'rewrite' => array("slug" => "service"), // Permalinks format
 'supports' => array('title','editor','thumbnail')

It seems to work ok, and I have created a few posts of this type. Now, when I want to get the link to the archive page, I do the following in my child theme:

$type = get_post_type(19);
var_dump( $type );
var_dump(get_post_type_archive_link( $type ));

The second line dumps "service", while the third one dumps null. Is it possible that a given post type doesn't have an archive page? Am I doing anything wrong? Thanks in advance.

  • has_archive is false by default.
    – Milo
    Jun 27, 2016 at 9:01

1 Answer 1


Ok, my fault. I only have to add an argument when creating the custom post type, 'has_archive' => true.

Thank you anyway for taking the time to read my question.

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.