I am using a custom taxonomy with the term slug 'nursery'. I'm also using a page with the slug 'nursery'. I can view the page fine, but trying to view the 'nursery' term archive page as fetched by get_term_link() just redirects me back to the page.

So, from this page:

I have a link to

But clicking on the link just redirects me back to

instead of showing me the archive page.

How can I view the archive page for that term?

Edit: code, as requested.

class Taxonomy {

  public $taxonomies;

  function __construct() {
    $this->taxonomies = $this->set_taxonomies();
    add_action('wp_loaded', array($this, 'register_taxonomies'));

  // Register our taxonomies
  public function register_taxonomies() {
    register_taxonomy('class', 'post', $this->taxonomies['class']);

  private function set_taxonomies() {
    return array(
      'class' => array(
        'public'        => true,
        'show_tagcloud' => false,
        'hierarchical'  => true,
        'rewrite' => array(
          //'slug' => 'class-blog',
          'with_front' => false,
        'labels' => array(
          'name'                       => _x( 'Classes', 'taxonomy general name', 'pys' ),
          'singular_name'              => _x( 'Class', 'taxonomy singular name', 'pys' ),
          'search_items'               => __( 'Search Classes', 'pys' ),
          'popular_items'              => __( 'Popular Classes', 'pys' ),
          'all_items'                  => __( 'All Classes', 'pys' ),
          'parent_item'                => null,
          'parent_item_colon'          => null,
          'edit_item'                  => __( 'Edit Class', 'pys' ),
          'update_item'                => __( 'Update Class', 'pys' ),
          'add_new_item'               => __( 'Add New Class', 'pys' ),
          'new_item_name'              => __( 'New Class Name', 'pys' ),
          'separate_items_with_commas' => __( 'Separate classes with commas', 'pys' ),
          'add_or_remove_items'        => __( 'Add or remove classes', 'pys' ),
          'choose_from_most_used'      => __( 'Choose from the most used classes', 'pys' ),
          'not_found'                  => __( 'No classes found.', 'pys' ),
          'menu_name'                  => __( 'Classes', 'pys' ),
      ), // end of 'channel' taxonomy

Slightly modified version to remove irrelevant stuff. The Taxonomy class is instantiated when functions.php is run.

  • Can you show the code that register the custom taxonomy? I can not reproduce your issue. – cybmeta Jan 13 '15 at 11:36
  • Code added - the fact that you can't reproduce it seems hopeful to me. – JasonC Jan 13 '15 at 11:51

Ok, resolved this.

I am now registering the taxonomy and terms on the init hook rather than wp_loaded and that seems to have fixed things.

I will accept this answer as soon as I can.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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