This seems to work!
?post_type=directors&name=$matches[1] seems to be the key
add_rewrite_rule( 'directors/([^/]*)/showreels/([^/]*)/video/([^/]*)/?', 'index.php?post_type=directors&name=$matches[1]&showreel=$matches[2]&video=$matches[3]', 'top' );
so final code now;
function wpse13483_init() {
add_rewrite_rule( 'directors/([^/]*)/showreels/([^/]*)/video/([^/]*)/?', 'index.php?post_type=directors&name=$matches[1]&showreel=$matches[2]&video=$matches[3]', 'top' );
}
add_action( 'init', 'wpse13483_init' );
function wpa52794_query_vars( $vars) {
$vars[] = 'video';
$vars[] = 'showreel';
return $vars;
}
add_filter( 'query_vars', 'wpa52794_query_vars' );
Related Posts:
- How to create custom URL routes?
- web.config conflict on IIS
- How do I remove a rewrite rule?
- add_rewrite_rule: $matches var not replaced by captured value
- How-to add rewrite rules to point the uploads folder to a subdomain
- Rewrite Rules for Multiple (more than 2) Taxonomies
- SEO Friendly URLs for my plugin categories
- How do I add a add_rewrite_rule without it redirecting?
- Mod_rewrite delete parameter in 301 Redirect
- add_rewrite_rule not working for page var
- WordPress URL rewrite regex
- WordPress keeps writing rewrite rules to .htaccess
- Adding the amp url prefix to the beginning
- WordPress Rewrite
- Tricky URL rewrite with custom values in url
- Add rewrite rule to call front-page.php?
- Add a query string to ALL links on site
- How make a multi language routes, with rewrite rules or rewrite endpoints?
- Add rewrite rule for rewrite endpoint
- Custom rewrite rule for backend/admin?
- Having trouble with using add_rewrite_rule and pagination
- How to have multiple rewrite endpoints in the same URL?
- add_rewrite_rule is not taking effect in WordPress? .htaccess file doesn’t update
- Regionalised Content
- Add specific word to default page permalink
- Rewriting URLs in WordPress
- add_rewrite_rule() to route to file other than index.php
- Rewrite rule to load images from production does nothing
- Custom query_vars and parse_request on wp-admin
- ‘rewrite_rules_array’ or ‘generate_rewrite_rules’ for adding custom rewrite rules?
- Have two different URLs show the homepage
- Custom rewrite not working
- My WP_options db rewrite_rules Does Not Work
- Disable Pagination on Pages
- Custom rewrite_rules – only pass numbers and not alphabetic characters
- Rewrite ugly URL to clean URL
- Rewrite wp-login.php URLS to static pages?
- How to add a custom redirect rule for Post as subdomains?
- How to preserve the query string while using add_rewrite_rule and default public query vars
- Rewrite custom post type URL parameters
- Changed pagination URLS to use p= instead of paged=
- How to use add_rewrite_rule in subdomain
- Change pagination url format
- Rewrite: WordPress URL rewrite on Search
- WPML language switcher for custom rewrite rules
- Rewrite the default post object’s permalink
- Enpoint Not Found in Rewrite Tag Permalink
- URL rewriting with custom user meta “/%shop_name%/gallery/%gallery%”
- URL Rewrite and add_query_var not working
- Custom Rewrite Rules
- URL Rewrite with Custom Variables
- How to add custom rewrite rules and point to specific templates
- Rewrite /category/cars into /topics/cars
- show ALL latest posts with archive.php on example.com/latest
- Keep requested/entered url with add_rewrite_rule
- Name page template properly
- Rewrite Rule for homepage not working correctly
- One off rewrite for single post-type slug (show normal page with same URL instead)
- WP redirect rule doesn’t work
- How to use wp rewrite to hide form action url?
- URL rewrite in theme doesn’t seem to be working
- WordPress Rewrite rule is not working
- Redirect URL to an existing page with query string or #! added on
- Rewrite rule that wp-login.php?action=register is left alone
- Trying to add array of paths to post permalink
- How to rewrite URL back to default custom URL if no destination found
- Use URI suffix as parameter and ignore when resolving page
- Why wordpress rewrite my custom URL?
- Rewrite rule regex help required
- Redirect empty search to another page
- Dynamic URL with rewrite rule not working
- Rewrite dynamic URLs as pretty URLs in WordPress functions.php (add_rewrite_rule) – what’s wrong with my code?
- How to get relative page for every post: /post-1/contact. /post-2/contact
- Rewrite rule not working, suspect redirect string
- WordPress Rewrite Rule to EITHER Match 1 or 2 Taxonomies when adding to URL
- Rewrite Rule added but showing 404 rather than specified page
- Blog List Page 404 With Custom Post Type Rewriting to Blog Parent
- Custom taxonomy Rewrite Rule
- WordPress doesn’t remember my custom rewrite rule
- Custom urls in WordPress involving page slugs
- I want to add one extra field to my URLs, I’m using Rewrite functions but it doesn’t work
- how to change some of the rules in the database
- Font Page overrides rewrites
- rewrite rules social share links
- Rewriting URLs with query strings and preserving them
- add_rewrite_rule is not fired
- Custom URL scheme – paramters on custom post type
- rewrite rule for home/index page
- WordPress Custom Rewrite Rule
- Additional .htaccess rules based on wp page
- URL Rewriting in WordPress
- Rewrite URL variable to custom path
- Rewrite function
- Programmatically add a custom url route “/category/index.json” to return a collection of posts in json
- Rewrite rule to simulate page hierarchy results in 404
- Rewrite URLs in a Custom Post Type with Multiple Taxonomies
- Rewrite rule giving 404 error
- WordPress picks a wrong template if ?cat= is used as URL parameter
- WP-Include rewrite directory
- How to combine nearly identical custom rewrite rules for WordPress