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

How can I fix this, i get an error 404 when i acess the second page of post-type

www.site.com/clipuri/2012/ www.site.com/clipuri/2012/page/2/

register_post_type('clip', array(   'label' => 'Clip','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => true,
'rewrite' => array('slug' => ''),
'query_var' => true,'has_archive' => true,
'menu_position' => 5,'supports' => array('title','editor','custom-fields','category', 'post_tag',),
'labels' => array (
'name' => 'Clip',
  'singular_name' => 'Clip',
  'menu_name' => 'Clip',
  'add_new' => 'Add Clip',
  'add_new_item' => 'Add New Clip',
  'edit' => 'Edit',
  'edit_item' => 'Edit Clip',
  'new_item' => 'New Clip',
  'view' => 'View Clip',
  'view_item' => 'View Clip',
  'search_items' => 'Search Clipuri',
  'not_found' => 'No Clip Found',
  'not_found_in_trash' => 'No Clip Found in Trash',
  'parent' => 'Parent Clip',
),) );

register_taxonomy("clipuri","clip", array("hierarchical" => true, "label" => "Cat Clip", 'show_ui' => true, 'query_var' => true, "singular_label" => "clipuri", "rewrite" => true, 'with_front' => true));

in theme i use

<?php global $wp_query;
$args = array_merge( $wp_query->query, array( 'post_type' => 'clip')  );
query_posts( $args ); ?>

<div class="nav">
<?php if(function_exists('wp_paginate')) {wp_paginate();} ?>

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
share|improve this question
What template is the theme code from? – helgatheviking Sep 29 '12 at 0:14
taxonomy-clipuri.php – Batman Sep 29 '12 at 0:19
Ok, so on your taxonomy archive you need to show 2 different post types? Let me try to work something up with pre_get_posts – helgatheviking Sep 29 '12 at 0:25
up vote 0 down vote accepted

For modifying the main query, I think it is best to take advantage of the pre_get_posts action.

When using pre_get_posts the $query variable is passed "by reference" which means we can directly manipulate the $query object with the shortcut functions such as set_query_var. Remove the query code from your taxonomy template, and try the following in your functions.php:

function wpa_66609( $query ) {
    if ( is_tax('clipuri') && is_main_query() ) {
        set_query_var( 'post_type', array('post','clip' ) );
add_action( 'pre_get_posts', 'wpa_66609' );

If that doesn't work, I'll try to debug it.

share|improve this answer
it works, thanks :) – Batman Sep 29 '12 at 0:34
Excellent! I was going to ask you some more questions after visiting your link, but now I don't have to. Cheers. – helgatheviking Sep 29 '12 at 0:35

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.