How To Reference Custom Taxonomy Terms
-
Problem: I’m getting a 404 Not Found message when trying to open a page containing all the entries for a particular term.
Scenario:
A custom content type called “video”
Attached is a custom taxonomy also called video with terms “cash” and “cash flow”What I want to do is to produce the following
My top level page is called Library and contains a link to a page that displays custom content type ‘named video’. The content of the page is a list of terms from the taxonomy attached to the custom content type viz:
– Cash
– Cash FlowThis result is produced using this template code:
<h2>Video Subjects</h2> <p>Click to see the list of videos under a particular subject</p> <?php $args_list = array( 'taxonomy' => 'video', // Registered tax name 'orderby' => 'name', 'style' => '', 'title_li' => __(none ) ); echo wp_list_categories($args_list); ?>
When you look at the list of terms on the page each one is a link to titles attached to that particular term, so the links are:
Simply clicking on this link produces a page not found.
Note that I have a template titled “taxonomy-video-cash” but clicking on the link for ‘cash’ still produces a page not found.As a result I created a page with a permalink of
https://www.example.com/library/video
And attached the template ‘taxonomy-video-cash.php
<?php $videoquery = new WP_Query( array( 'post_type' => 'video', 'terms' =>'cash', 'posts_per_page' => 10 )); // The Loop if ($videoquery->have_posts()) { while ( $videoquery->have_posts() ): $videoquery->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; }; // Reset Post Data wp_reset_postdata(); ?>
This also causes a Page Not Found result.
Note: I’m using the plugin ‘Custom Post Type UI’, with a rewrite on the Custom Post Type set to library/video
Any suggestions on how to produce the display of titles for a particular term.
I’ve done a lot of searching on this subject and the totality of advice and tutorials just seems unusually confusing since I’m very much a neophyte in using WordPress.
Thanks
- The topic ‘How To Reference Custom Taxonomy Terms’ is closed to new replies.