Skip to main content
edited tags
Link
hakre
  • 12.9k
  • 6
  • 49
  • 85
added 1144 characters in body
Source Link

My question is fairly basic. I have an archive.php and inside I have the main loop like so:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Do stuff here

<?php endwhile; endif; ?>

Works fine for categories but not for custom taxonomies. I have a custom taxonomy called "Type". I go to the WordPress menu and add the term "Spa Break" from the "Type" taxonomy.

This works, however I get about 10 of each post for every post. All the ID's for the duplicate posts are the same, it just decides to list 10 of each.

I have added no custom queries or anything like that.

Any clues to what might be happening?

Here is my taxonomy:

function build_taxonomies(){
register_taxonomy("type", array("venue"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => array('slug' => 'type'))); 

}

Here is my post type code:

function create_post_type() 
{
    $labels = array(
        'name' => __( 'Venue' ),
        'singular_name' => __( 'Venue' ),
        'rewrite' => array('slug' => 'venues'),
        'add_new' => _x('Add New', 'venue'),
        'add_new_item' => __('Add New Venue'),
        'edit_item' => __('Edit Venue'),
        'new_item' => __('New Venue'),
        'view_item' => __('View Venue'),
        'search_items' => __('Search Venue'),
        'not_found' =>  __('No venues found'),
        'not_found_in_trash' => __('No venues found in Trash'), 
        'parent_item_colon' => ''
      );
      
      $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true, 
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail', 'custom-fields', 'comments')
      ); 
      
      register_post_type('venue',$args);
}

Thanks in advance.

My question is fairly basic. I have an archive.php and inside I have the main loop like so:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Do stuff here

<?php endwhile; endif; ?>

Works fine for categories but not for custom taxonomies. I have a custom taxonomy called "Type". I go to the WordPress menu and add the term "Spa Break" from the "Type" taxonomy.

This works, however I get about 10 of each post for every post. All the ID's for the duplicate posts are the same, it just decides to list 10 of each.

I have added no custom queries or anything like that.

Any clues to what might be happening?

Here is my taxonomy:

register_taxonomy("type", array("venue"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => true)); 

Thanks in advance.

My question is fairly basic. I have an archive.php and inside I have the main loop like so:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Do stuff here

<?php endwhile; endif; ?>

Works fine for categories but not for custom taxonomies. I have a custom taxonomy called "Type". I go to the WordPress menu and add the term "Spa Break" from the "Type" taxonomy.

This works, however I get about 10 of each post for every post. All the ID's for the duplicate posts are the same, it just decides to list 10 of each.

I have added no custom queries or anything like that.

Any clues to what might be happening?

Here is my taxonomy:

function build_taxonomies(){
register_taxonomy("type", array("venue"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => array('slug' => 'type'))); 

}

Here is my post type code:

function create_post_type() 
{
    $labels = array(
        'name' => __( 'Venue' ),
        'singular_name' => __( 'Venue' ),
        'rewrite' => array('slug' => 'venues'),
        'add_new' => _x('Add New', 'venue'),
        'add_new_item' => __('Add New Venue'),
        'edit_item' => __('Edit Venue'),
        'new_item' => __('New Venue'),
        'view_item' => __('View Venue'),
        'search_items' => __('Search Venue'),
        'not_found' =>  __('No venues found'),
        'not_found_in_trash' => __('No venues found in Trash'), 
        'parent_item_colon' => ''
      );
      
      $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true, 
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail', 'custom-fields', 'comments')
      ); 
      
      register_post_type('venue',$args);
}

Thanks in advance.

edited title
Link

How to prevent posts duplicating when viewing a custom taxonomy term.

Source Link
Loading