I’d do it something like this.
First, register a new query var, so WP will acknowledge its existence:
add_filter( 'query_vars', function( $query_vars ) {
$query_vars[] = 'cast';
return $query_vars;
});
Next, add a rewrite rule, which converts the pretty permalink version of your URL behind the scenes:
add_action( 'init', function() {
add_rewrite_rule(
'^movie/([^/]+)/cast/?$',
'index.php?movie=$matches[1]&cast=1',
'top' );
} );
(You’ll probably need to flush permalinks at this stage.)
Finally, add a clause into your archive (or whatever template you’re using) to detect the query var, and act accordingly:
if ( get_query_var('cast') ) {
// Do what you need to do,
// probably grab the term and use that
// to display the term meta
}
Related Posts:
- How to only list the child terms of a taxonomy and not their parents?
- How to use taxonomies on attachments with the new Media Library?
- Hierarchical taxonomy UI
- How to display custom taxonomies in posts?
- Filtering custom taxonomies
- Allowing specific users to only add posts using certain custom taxomy terms
- Edit tags page for hierarchical taxonomy doesn’t show taxonomies at all depths
- I want to load post content by categories using Ajax
- Get only the first term by taxonomy
- Hook to process a new taxonomy tag before it is created?
- Removing taxonomy base using WP rewrite
- get_terms() returns an empty array
- Scheduling posts to update once per day with wp_cron
- How to find taxonomy name using only taxonomy TERM ID (or taxonomy term name)
- Multiple users – only allow them to manage their own terms for custom taxonomy when logged in
- WP_insert_term how to insert multiple values as taxonomny term?
- How to include parent terms in hierarchical taxonomy URLs?
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- Custom taxonomy term as class?
- How to edit/remove a term that’s in multiple taxonomies?
- Using a loop to display terms associated with a post
- Custom Taxonomy: Parent still counting deleted Child
- Improving WP_Query performance for multiple taxonomies
- Create Child Taxonomies
- how to create a proper query for getting a list of users with taxonomy related meta key
- How to add custom field to custom taxonomy in 4.4
- Taxonomy page template changing when using query variables
- Get direct children of custom taxonomy
- List subcategory on taxonomy term page
- Operations with custom fields values in a loop
- How to insert an array of terms using wp_insert_term?
- Create Advanced search with taxonomies (not filter list)
- How to get custom post type taxonomy
- remove sanitize_title() for register_taxonomy()
- Can I use a Custom Meta Value inside of ‘get_the_terms’?
- has_term if/echo else/echo function
- Tell the difference between a term and page when they have the same ID
- add hirarchy of categories in products grid of visual composer
- How to use multiple archive templates for a taxonomy?
- Hiding taxonomies with no children WP_Query & tax_query
- Custom taxonomy for Media Library
- Clicking Add New button for custom taxonomy only moves element
- How do I return all terms from multiple taxonomies?
- Returning One custom taxonomy term name
- Restrict editing of posts with specific taxonomy to users with a matching meta value?
- Hide terms if they aren’t the same as the current term
- Corrupted nav-menu?
- Hide taxonomy when term is empty
- The best way to display taxonomies
- Dynamically set taxonomy term and show admin notice on post save
- Remove taxonomy widget from “PAGE” post
- WP 4.8 : new taxonomy syntax for get_term_by and get_term_link ?
- Custom rewrite permalink doesn’t work
- Can you hide empty terms using get_term_children?
- Register `product_cat` taxonomy for default post post type
- Don’t display taxonomy if empty
- how to access the $query variable inside taxonomy-xxx.php template file?
- List terms of custom taxonomy if matches other taxonomy
- Order custom taxonomy by date
- Permalink issues with custom taxonomies
- Insert taxonomy slug into loop class
- wp_set_post_terms example?
- Change the full permalink (URL) of a single post by connecting it to a specific page
- Where to find relation of custom post type category with it thubmnail image in wordpress database
- Adding term to a custom taxonomy based on term from product category
- Add taxonomy column with meta field (ACF) content
- Warning: Undefined variable $post in C:\xampp\htdocs\… after PHP upgrade
- How to display taxonomy terms in a dropdown on a user edit page
- Custom Taxonomy archive.php template naming not working
- Remove custom taxonomy slug from URL
- How to appear plural or singular custom taxonomy name(-s) inside woocommerce single product meta php file
- Filter Tags for current users
- Add term to taxonomy programatically
- How to filter a page title with custom taxonomies
- How can I rewrite a custom taxonomy archive slug
- Custom TaxonomyTemplate
- Assign a default description to new terms under a custom taxonomy
- Orderby taxonomy term id using get_posts not working
- Searching JQuery arrays of taxonomy terms for word matches in frontend images upload
- Display taxonomy posts
- Post Class for Custom Taxonomy Error
- How do I deliver posts based on user geolocation
- Order posts with custom taxonomy array
- How to perform a search inside a specific taxonomy category
- How can i set post_per_page in my taxonamy?
- Retrieve name or slug from get_objects_in_term
- Exclude 2 in 3 terms of A Taxonomy from all Archives
- register_taxonomy – show in admin menu, but not on post type (edit) screen
- Altering term_id and name via $wpdb class
- Display Parent and child taxonomies in seperate drop downs [duplicate]
- Advanced WordPress search form based on custom taxonomy and custom meta value
- Get Taxonomy and metadata
- More than one Hierarchical Taxonomy and SEO
- Woocommerce – how to get and display selected variations on single product page
- Filter posts and custom taxonomy using add_rewrite_rule
- Get taxonomy that is attached to post with all its parents
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- How to looping taxonomy terms?
- Template hierarchy html with taxonomy in 6.2
- Hide empty categories on widget