Get random out from get_terms()
Get random out from get_terms()
Get random out from get_terms()
Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
Unset actions for terms parent only
There is an example of how to do this on the official doc for WP_Query: https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters Specifically, by declaring multiple items in the tax_query and setting their relation: Display posts that are in the quotes category OR have the quote post format: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( … Read more
I deleted problematic entries from wpgy_terms on database then it works now.If you are new at database, I suggest that backup your database before do something on it.
That’s easy, instead of trying to change which template gets loaded, load the single-grants.php template, then use get_template_part inside it, and pass different values based on the terms the post has. Be careful though, single-termname.php is not a good naming scheme, as it could be abused, e.g. you could encounter clashes. It would be better … Read more
Solved. The posts were not assigned to the taxonomy.
Could look into using get_ancestors();. It will get an array of all of the ancestors of the item in order from lowest to highest. See: https://developer.wordpress.org/reference/functions/get_ancestors/
The taxonomy template you have (taxonomy-insight_type-academia.php) is in the form of (taxonomy-{taxonomy}-{term}.php), and the format for is_tax() is is_tax( ‘<taxonomy>’, ‘<term>’ ), so in your pre_get_posts callback, you should: // Use this. if ( $query->is_tax( ‘insight_type’, ‘academia’ ) ) // Not this. if ( $query->is_tax( ‘academia’, ‘insight_type’ ) ) Additionally — to avoid conflict with … Read more
Could you not just keep the same taxonomy and declare it on both CPTs?? That way both would inherit the same terms, at the same IDs, which would allow you to get posts from both CPTs if required. At your CPT creation, you can tell it which Taxonomies to use by setting a parameter of: … Read more