Skip Navigation

[Resolved] Custom Post Type posts are not displayed in Category term archive pages

This support ticket is created 2 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 3 voices.

Last updated by umbertoZ 2 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#2266541
img1.jpg

Hi, I built 2 CPTs, Resources and News. I assigned them the default taxonomy Category and I aspected to display on my Category terms archives all the associated Posts, Resources and News. For some reason News are not displaying.

Both CPTs has the same configuracion (publicly_queryable is checked and exclude_from_search is not), actually I can see their posts and I can loop them in views.

For example, I've the Research Studies term, the count in the wp-admin Category page is 10 (see img1.jpg).

If I check it under News (/wp-admin/edit.php?category_name=research-studies&post_type=news) I see there are 8 News associated to Research Studies.

If I check it under Posts (/wp-admin/edit.php?category_name=research-studies) I see there are 2 Posts associated to Research Studies.

Then if I check my archive page /research-studies/ I only see the 2 Posts.

It works fine for the other CPT Resources, I can see Resources in other terms archive pages.

Can you help me?

cheers

#2266577

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2022-01-14 at 15.23.41.png

Did you make a custom category archive, or is the normal theme category archive?

If you are using the legacy editor, when you make a taxonomy archive with Toolset in the content selection you specify which post types should be included in the results. See the screenshot.

If you are using the legacy editor, double check that.

The option isn't available with the block editor for WPAs, it includes all post types that have the taxonomy assigned.

If you are using the block editor and posts of one type are missing, that looks like a problem.

Please let us know which applies.

#2267761

Hi Nigel, I'm using the block editor and the problem persist. I made a test rebuilding it, but it still don't load the news CPT.

#2268719

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Umberto,

I did a short test on my end with a custom post type and a custom taxonomy and without any change or even without a custom archive I was able to see the post from my custom post type displaying on the archive as well as from the default post type as well.

Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?

Please where applicable please provide me with a link to an example page where I can see the issue. Also let me know which post type is not showing up.

I've enabled the private fields for your next response.

Thanks,
Shane

#2270751

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2022-01-19 at 3.55.15 PM.png

Hi Umberto,

It would appear that your archive is getting the post types that have the taxonomy assigned. I did a dump of the $query variable onto the archive page and the post_type array is this below.

 ["post_type"]=> array(3) { [0]=> string(9) "resources" [1]=> string(4) "news" [2]=> string(4) "post" } }

As you can see it includes both your resources and news post type.

The strange thing is even though the news post type is included its not present on the frontend. This prompted me to create a new archive to test a theory. It turns out that when I revert my test archive to the classic editor for the archive, the News post type as not included. What I did was to set the News post type to be included as per nigel's instructions in the previous post, then revert back to the block editor for the archive.

If you check my archive here hidden link you will notice that all the posts are now being displayed on the frontend.

So it would be best to switch your archive to the classic editor by using the Use Classic Editor button. See Screenshot

It should be noted that this will reset your archive so you will essentially need to remake it when you've switched on both occasions.

Thanks,
Shane

#2273277

My issue is resolved now. Thank you!