Archived topic
Posts not showing on Tag archive
11 replies · Started by David on December 7, 2022
Hello
I've set up a query loop and set it to show on tag archive, but archive pages are showing up blank...
https://www.hatfieldinteriors.com/tag/ffe/
Please see image attached - any ideas why nothing is showing?
Thanks
Dave
Hi there,
in the query Loop settings you will see an Option to: Inherit Query from Template - enable that.
I've done that but it's still shows up blank...
https://www.hatfieldinteriors.com/tag/ffe/
Can you uncheck that option.
Remove any of the other paramters that were added.
And then re-enable that option.
No luck with that. I've provided credentials. It's in elements > Block : Projects Archive Tag
Can you take a look and see what I'm doing wrong.
Hi David,
Can we see the original tag archive without this element being activated?
Just want to make sure there're posts in this tag archive.
Let me know!
Hi Ying, I've done that, nothing found...
https://www.hatfieldinteriors.com/tag/ffe/
Are those Tags being used the core Tags ie. for Posts ?
I think so, is it possible to separate them out? Do I need to set up a specific taxonomy that sits in posts?
Try this PHP Snippet to include your CPT in those tag archives:
function db_custom_post_type_for_tags_archive( $query ) {
if ( $query->is_main_query() && ! is_admin() && ( is_tag() && empty( $query->query_vars['suppress_filters'] ) ) ) {
$query->set( 'post_type', array( 'post', 'your_post_type_slug' ) );
}
}
add_action( 'pre_get_posts', 'db_custom_post_type_for_tags_archive' );
Change the your_post_type_slug accordingly.
I've ended up setting a taxonomy called categories and assigned it to Projects and that's working...
Glad to hear that !