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 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?
- 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
- 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?
- 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
- 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
- How to add images to taxonomy terms? [duplicate]
- How to list tags from custom post type attachments?
- How to get custom category’s link?
- one post per term 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
- 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
- Is it possible to filter a taxonomy archive by other taxonomies that are on posts?
- 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
- taxonomy query on front page
- Using wp_tag_cloud with only current post tag with special class
- How do you search for a post by custom taxonomy?
- Next/Previous links in custom taxonomy, where item may belong to multiple terms
- How to query authors by custom taxonomy?
- Get Posts by tag from a custom taxonomy
- Display the first tag assigned to a post
- Display custom post taxonomies
- Adding a query var to taxonomy term archive – gets redirected to the other taxonomy archive page
- How to get multiple Taxonomies not All Taxonomies?
- WordPress Taxonomy Menu
- How to randomise a custom taxonomy tag cloud
- How do i change the tags and taxonomies
- 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
- 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