This post is super old but I’ll post my solution here in case anyone else stumbles across this.
If you’re using Yoast SEO you can hook into their existing implementation (they do this already for categories).
function add_variety_primary_term_taxonomy( $taxonomies, $post_type, $all ) {
if( $post_type == 'product' && isset( $all['my_custom_tax'] ) ) {
$taxonomies['my_custom_tax'] = $all['my_custom_tax'];
}
return $taxonomies;
}
add_filter( 'wpseo_primary_term_taxonomies', 'add_variety_primary_term_taxonomy', 10, 3 );
Also, your custom taxonomy must have ‘hierarchical’ => true for this to work.
Good luck!
Related Posts:
- How to remove the tag cloud from custom taxonomy admin page?
- How to add images to taxonomies?
- Custom columns on edit-tags.php main page
- custom post type taxonomy “tag” archive : no post found
- Custom Taxonomy and Tax_Query
- Exclude Specific Term from Search
- How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?
- Can I turn off write-in tags/taxonomies?
- Is it possible to use one slug for Multiple Taxonomies?
- Widget to display custom taxonomy tag cloud
- SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- How to display and use all existing tags at my write-post-at-frontend-panel?
- Combine multiple custom user taxonomy in single url
- how to get title to custom tags page
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- Can I turn off write-in tags/taxonomies?
- Advanced Tax Query
- Improving WP_Query performance for multiple taxonomies
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- WordPress renames slug of tags used in multiple taxonomies?
- How can I display all post IDs from the taxonomy?
- Allow only 1 instance of each term in each custom taxonomy
- How do I make a custom taxomony appear like tags?
- Get ID and slug from taxonomy object
- How to display custom taxonomy in multiple columns?
- Custom taxonomies making WP very slow – Way to fix?
- How to count the number of terms in a taxonomy
- Make tag cloud links consistent
- Sorting taxonomy columns by meta value numeric
- Get Taxonmy Term ID For Current Post
- Display sub categories and their data of a taxonomy
- Advanced Query Logic With Multiple Taxonomies
- Display only first level children of my custom taxonomy categories
- Hook to change Custom Tag Taxonomy Links?
- Is it possible to get all term items from a custom taxonomy regardless of post attachment status?
- How to adjust code to refresh a dropdown box with tags that are active on filtered category listing
- Metabox to list/store a certain type of post tag
- Changing stylesheet depending on custom taxonomy terms
- Sorting Tags by Slug Value
- How do I taxonomy terms based on terms they are used alongside?
- Custom taxonomy [year] is directing to yearly archive
- Get posts by term slug only
- Taxonomies on custom taxonomies
- Help with Taxonomies
- Extend & Search Native WordPress Image Galleries With Tags and Taxonomies?
- Add Custom Taxonomy for Blog Meta Info
- How to filter a post in the Tag Cloud widget, using tags of a media library image attached to the post?
- Search Tool only refreshes Page without showing results
- Replace taxonomy permalinks
- Getting associated taxonomies
- How to fetch the data from Advanced Custom post when we search specific keyword or field name related to the post?
- Front-End Custom Taxonomy Tag Select
- Create custom taxonomy and Display in metabox dropdown
- Problem with removing post tags programmatically
- How to add images to taxonomy terms? [duplicate]
- How to list tags from custom post type attachments?
- How to get custom category’s link?
- saving meta/custom field to tag
- one post per term taxonomy
- Changing input type from text to multi select dropdown – skill taxonomy
- Show only the sub-categories (and their content) of the current custom taxonomy with ‘taxonomy.php’
- Using Advanced Custom Fields Relationship Field to select a taxonomy term
- Custom arguments in WP_Query
- Displaying user selected custom tags/taxonomies on the front-end
- check if a taxnomy queried in $wp_query?
- WP_Query tax_query – Show results if child has parent X
- Query custom taxonomy for category including children
- Variable Not Working Inside is_author() Array
- Featured Images for Tags?
- Displaying the post count of all custom taxonomy terms in a list format
- Automatically tag posts based on user-defined words [closed]
- making an index from custom taxonomies and tags of posts (not hierarchical taxonomy)
- How to get related taxonomies based on a category with mysql query?
- Set two terms for a post when they differ only by an accent
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Tracking the name of a custom taxonomy
- Add terms to a taxonomy archive from within the same taxonomy
- Is it possible to filter a taxonomy archive by other taxonomies that are on posts?
- Fill New Taxonomies
- Custom Taxonomies Archive Page 404
- Get tags name under custom taxonomy in wordpress
- WordPress taxonomy terms archive template help
- Filter Tags for current users
- Limit Tag Links in Post Content
- Change the Page Title of the Archive Page for Portfolio Tags
- Make relation of custom taxomies
- List active taxonomy terms
- Any way to make custom taxonomy field searchable?
- How to get tags with custom taxonomy field?
- Get taxonomy image for Toolset custom taxonomy through Toolset Views Shortcode
- wp_get_object_terms count on taxonomies within an category archive
- List posts grouped by children of a custom taxonomy
- Group custom taxonomies based on tags contained in their posts
- Make custom post type display with custom taxonomy in url
- Hook to filter based on form value and insert term
- Complex Taxonomy scheme
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- Foreach for get_the_terms for hierarchical taxonomy don’t repeat Top Level Terms if contains multiple Second Level Terms