We're merging with GenerateBlocks! Learn more here.

Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Show posts in current category and specific tag Reply To: Show posts in current category and specific tag


Sorry, I can’t get this to work. Assuming the tag I want to limit shown posts to is called “new”. How would I add that to the snippet?

How are you defining primary categories?

I assumed it’s from the GP theme, but it’s from the SEO plugin, so this is how one would access the primary category according to the dev:

// WordPress core:
$term_id = get_post_meta( $post_id, ‘_primary_term_’ . $taxonomy, true ); // int or false

//= TSF 3.0+:
$term = the_seo_framework()->get_primary_term( $post_id, $taxonomy ); // WP_Term or false.
$term_id = the_seo_framework()->get_primary_term_id( $post_id, $taxonomy ); // int

As mentioned above ideally it would look for Primary Category (if not available)-> Subcategory (if not available)-> Any Category.

Looking at the WP_Query parameters I couldn’t find anything for subcategory specifically. Is there a workaround?