WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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)
    register_post_type('agenda', $event_args);
add_action('init', 'create_event_type');

Thanks in advance!

share|improve this question
I see you have a closing tag, just encase, this code needs to be in functions.php or in a plugin, placing it in a template means when the code runs it's too late – Tom J Nowell Aug 21 '14 at 23:19

You need to setup pagination when you query your custom post something like this

$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;

share|improve this answer

You need to reset your permalinks... "powercycle them" :) click "Numeric" -> Save then back to "Post Name" and save (or vice versa)

share|improve this answer
just visiting the permalinks settings page flushes rewrite rules, no need to change anything. – Milo Mar 1 '13 at 23:43
Good to know @milo! – BenRacicot Mar 7 '13 at 18:32

I had the same problem and I found the answer today. I've added a rewrite rule for a workaround.

check my answer for this question: wrong template for page of archive

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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