0

I want to preface this by saying we HAVE tried saving and re-saving the permalinks structure.

We are developing a custom theme and have a few custom post types in our theme. An example of one of them is below.

function broadcast_post_types() {
$labels = array(
    'name'               => 'Broadcasts',
    'singular_name'      => 'Broadcast',
    'menu_name'          => 'Broadcasts',
    'name_admin_bar'     => 'Broadcasts',
    'add_new'            => 'Add New Broadcast',
    'add_new_item'       => 'Add New Broadcast',
    'new_item'           => 'New Broadcast',
    'edit_item'          => 'Edit Broadcast',
    'view_item'          => 'View Broadcast',
    'all_items'          => 'All Broadcasts',
    'search_items'       => 'Search Broadcasts',
    'parent_item_colon'  => 'Parent Broadcasts:',
    'not_found'          => 'No Broadcasts found.',
    'not_found_in_trash' => 'No Broadcasts found in Trash.'
);

$args = array(
    'public'      => true,
    'labels'      => $labels,
    'description' => 'These broadcasts are a replay of Wisco Radio Content',
    'menu_icon'   => 'dashicons-format-video',
    'hierarchical'=> true,
    'has-archive' => true
);
register_post_type( 'broadcast', $args );

We run into a problem where when we try to visit this archive page (localhost/broadcast/), it either takes us to a single post (localhost/broadcast/post1) or a 404.

We have tried to reset the permalink setup and have ensured has-archive is set to true.

We are doing our local environment using MAMP and have a sandbox hosted online as well and this is happening at both locations. Any thoughts?

  • 4
    It is has_archive and not has-archive.. – Sally CJ Feb 5 at 8:19
  • Simple overlook - that's what it was. thanks @SallyCJ – WiscoRadio Feb 5 at 17:02
  • You're welcome and don't forget to accept your answer. :) – Sally CJ Feb 6 at 3:16
0

Turns out I had has-archive instead of has_archive. After a permalink refresh, the archive page now appears.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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