• I have successfully created a custom taxonomy ‘Authors’ for quotations by adding the following code in my child theme’s functions.php:

    /**
     * Add custom taxonomies
     */
    function add_custom_taxonomies() {
      // Add new "Authors" taxonomy to Posts
      register_taxonomy('author', 'post', array(
        // Hierarchical taxonomy (like categories)
        'hierarchical' => true,
        // This array of options controls the labels displayed in the WordPress Admin UI
        'labels' => array(
          'name' => _x( 'Authors', 'taxonomy general name' ),
          'singular_name' => _x( 'author', 'taxonomy singular name' ),
          'search_items' =>  __( 'Search Authors' ),
          'all_items' => __( 'All Authors' ),
          'parent_item' => __( 'Parent author' ),
          'parent_item_colon' => __( 'Parent author:' ),
          'edit_item' => __( 'Edit author' ),
          'update_item' => __( 'Update author' ),
          'add_new_item' => __( 'Add New author' ),
          'new_item_name' => __( 'New author Name' ),
          'menu_name' => __( 'Authors' ),
        ),
        // Control the slugs used for this taxonomy
          'rewrite' => array(
          'slug' => 'authors', // This controls the base slug that will display before each term
          'with_front' => false, // Don't display the category base before "/Authors/"
          'hierarchical' => true // This will allow URL's like "/authors/abdul-kalam/"
        ),
      ));
    }
    add_action( 'init', 'add_custom_taxonomies', 0 );

    Then I have added an ‘author’ from my WP admin. Next I added a post with author ‘Abdul Kalam’. The post is clearly displaying the hyperlinked author name (added some code in parent theme’s single.php).

    Next I duplicated parent theme’s archive.php to taxonomy-authors.php to list all the ‘authors’. Also created another duplicate of archive.php to taxonomy-authors-abdul-kalam.php to show all posts that are tagged with author abdul kalam.

    Problem is, I get a 404 error page whenever I browse to example.com/authors/ or to example.com/authors/abdul-kalam/. I have flushed permalinks some 10-15 times but no luck.

    What am I doing wrong?

  • The topic ‘Custom Taxonomy Listing Page Issues’ is closed to new replies.