in order for the discography rule to work, I changed the rule from:
add_rewrite_rule( 'artists/([^/]+)/discography/?$', 'index.php?album_artist=$matches[1]&discography=yes', 'top');
to this :
add_rewrite_rule( 'artists/([^/]+)/discography/?$', 'index.php?artists=$matches[1]&discography=yes', 'top');
What the original rule was doing was pointing to the Artist’s Name and not the Artists custom post type, thus failing to redirect to the template. Thanks a lot to @RachelCarden for this.
Related Posts:
- Redirect page to homepage, keeping URL
- Need help with add_rewrite_rule
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Permalink format: singular or plural
- Pretty permalinks for search results with extra query var
- How to get pretty URLs with add_query_arg in permalinks
- Custom post type permalink endpoint
- Using $_GET variables in the URL?
- URL rewrite based on a custom field value
- How to change author base without front
- How to create a permalink structure for posts in a specific category
- How to map permalinks with accented letters to sanitized slugs?
- Add custom directory in URL
- Using two permalinks for one post
- Custom rewrite rules for a $_GET request
- Nice RSS Feed URLs for each custom post type
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- Put post ID on the custom post type URL
- Rewrite url / permalink for default archive – yearly / monthly
- Random Alphanumeric Key URLs
- Permalinks, Rewrites, Get Variables, Oh My!
- Change permalink for a single post entry
- Remove the Parent category from the permalink but leave the child category
- Apostrophe in permalink results in page not found
- Change permalinks with ACF values
- Multilanguage URLs
- Custom taxonomy rewrite using tax name instead of rewrite slug
- I need a custom permalink for my website
- Attachment Page Permalink/URL Rewrite Issue. How to change the actual rewriting?
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Does changing a post title of a published post automatically change permalink?
- Remove custom taxonomy base from URL
- Add custom post type name in term link?
- add_rewrite_rule not working for me
- Using WP Rewrite, but just not “getting it”
- Force wordpress to display page with same url structure as categories
- How can i have a custom post type with more slugs for each post?
- Rewrite CPT permalinks and include WPML language
- URL rewriting: removing the site’s basename for a specific category
- How can I get this custom post type permalink structure? %custom_post_type%-%taxonomy%-%term-postname%
- Rewrite rule intended for CPTs gives 404 for pages
- Unable to get /%postname%/ permalinks working, 404 on all links
- Permalink structure between 2 custom post types and a taxonomy
- Do WordPress Permalinks Refer to a Lookup Table in the Database?
- 404 error using Meta for Permalink rewrite
- Disable date based archives for all categories except one
- Permalinks only for posts
- How to rename ‘Tag Base’ with WPeC 3.8?
- Custom rewrite rule ignored
- mod-rewrite exception? keep #hash in matching urls?
- How to handle paging/pagination with a custom permalink?
- Remove parent page from url
- Visiting posts results in 404 errors after host migration
- Custom URL rewrites for templates
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- How to change custom post type, blog post and page permalink by template?
- add_rewrite_rule – Page Slug from “/foo-bar/” to “/foo/bar/”
- Access or edit custom generated permalinks with WP_Rewrite
- optional parameter in permalink structure
- Custom permalink structure with %postname% in front of domain name
- How can I set up a secondary permalink structure?
- How to get raw unwritten querystring
- How to Use metada Value in Url and is it possible? [duplicate]
- All in One Seo and Permalinks
- How do I rewrite attachment urls when permalink structure contains %category%?
- Custom child page permalink
- Safest way to create a custom permalink
- Creating an alternate path for a page
- rewrite based slug standar post wp
- How to change URL from /%postname%/ to custom-name/%category%/%year%/%monthnum%/%day%/%postname%/
- remove SLASH on single_post but KEEP on categories and parent pages
- Adding a ‘blogs’ prefix in the URL structure but only for blogs
- WordPress Attachment Page URL Rewrite!
- Extra url paths as variable
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Add slug to default post permalinks ONLY
- Permalink structure /page/page/cpt-post gives 404 with pagination
- a way to support totally different url structure
- Multiple Permalink Patterns for one page
- Pretty Filter URL
- How to change URL of my pages?
- Dynamically populate permalinks
- Converting WP Page to use full explicit paths?
- Prevent guessing slug
- Once redirected by Rewrite rules, how can WordPress know the page?
- Customize category permalinks
- WordPress permalink still not working (error or not understood?)
- Update permalinks
- Losing the original URL when using add_rewrite_rule
- Custom Permalink Base
- My wordpress site must be being affected by outside sources [duplicate]
- URL to an image in a post is changing when permalink is set to custom. Can I avoid this?
- how to create several url aliases for a page
- Permalinks, how to show them in post
- permalinks url with woocommerce
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- Blog url disappears
- Add additional URL variations for a Post
- Using a variable in page permalink
- How to make my custom permalink pull up the correct post