no posts shown on custom taxonomy archive
-
Hi,
I used Pods to create both a custom post type and a custom taxonomy (in a custom theme), let’s call the CPT “picture” and the taxonomy “motive” for the following example. I assigned the “motive” taxonomy exclusively to the “picture” CPT.
The CPT works well – I created a php template (single-picture.php) for its single pages, in which I used the WP function
the_taxonomies()
. This displays the name/s of the current taxonomy term/s of the post, linked to their archive pages (actually I only have one term per post, so it’s only one link). BTW: I am not even sure if “term” is the right word here – what I mean is something like the category name, but applied to taxonomies.Now let’s say the taxonomy term is “landscape”. So that link calls an URL like
https://www.example.com/motive/landscape
when clicked. Since the “motive” taxonomy is only used for the “picture” CPT, I would expect all “picture” custom posts which have the “landscape” term assigned to them to be displayed in a list, like regular posts on a blog page. However, the resulting page (which uses the “index.php” template) displays no posts, but instead the message which is written in theelse
part of the WP loop!Now, I *can* create a
taxonomy-motive.php
template and use a custom query in it, querying the desired CPT and taxonomy name, which works. But I would expect that also the standard WP loop/query in the index.php file returns a list of those posts?Did I oversee anything or will a regular WP loop really *not* display any posts in this situation?
P.S.: One additional detail – I don’t know if it makes any difference: My WP site uses a subdirectory of a domain as its home URL, like
https://www.example.com/mysite
. So the above mentioned link is actuallyhttps://www.example.com/mysite/motive/landscape
.
- The topic ‘no posts shown on custom taxonomy archive’ is closed to new replies.