I've an issue on custom post type, I've create a custom post type called "Agenda" and the rewrite url for http://example.com/agenda it works correctly, it points to the archive-agenda.php template but for http://example.com/agenda/page/2 it shows 404 error, what do you suggest me? The code that I've used to add the custom post type is:
<?php
function create_event_type() {
$event_args = array(
'label' => __('Agenda'),
'singular_label' => __('Evento'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'rewrite' => true,
'has_archive' => true,
'publicly_queryable' => true,
'show_in_nav_menus' => true,
'query_var' => true,
'supports' => array(
'revisions', // (will store revisions)
//'page-attributes', // (menu order, hierarchical must be true to show Parent option)
'title',
'editor')
);
register_post_type('agenda', $event_args);
}
add_action('init', 'create_event_type');
?>
Thanks in advance!
functions.php
or in a plugin, placing it in a template means when the code runs it's too lateadd_action
function is running too late. Place it at the earliest possible place infunctions.php
or a plugin file somewhere.