I wound up using the index_template
filter to load the right template when the CPT single page is being incorrectly redirected to the index and $_SERVER['REQUEST_URI']
contains the slug of the CPT. Like so:
add_filter('index_template', 'wpse300393_resolve_cpts_with_dots_in_name');
function wpse300393_resolve_cpts_with_dots_in_name($templates=""){
if( strpos($_SERVER['REQUEST_URI'], 'artwork') !== false ){
$templates = locate_template( 'single-artwork.php' );
}
elseif( strpos($_SERVER['REQUEST_URI'], 'artist') !== false ){
$templates = locate_template( 'single-artist.php' );
}
return $templates;
}
Related Posts:
- How does WordPress create URLs that Apache knows about?
- WordPress on VirtualBox – no pretty permalinks
- How to get full content including template HTML
- WordPress on Ubuntu 12.10: permalinks problem
- Is there a wordpress function that I can use to retrieve the current page that is loaded?
- 404 with post name permalinks
- .htaccess file missing from WordPress install directory
- Permalinks not working Apache + CentOS 7
- WordPress Permalinks still not working despite all necessary settings
- Page preview is shown, updating page gives 404 error
- Get the url of a page template without using the page slug and ID
- All top-level pages are using index.php as template
- Unable to get /%postname%/ permalinks working, 404 on all links
- Changing permalink name redirects to another template?
- Environment independent way to link to certain pages on frontend
- Permalink for specific page name
- how to prefer static page if it exists over wordpress page
- Get Posts Based on Tag Matching Page Title
- how to set up wp in folder within static website?
- The requested URL was not found on this server [closed]
- How to enable %postname% permalinks on Mac?
- How to make different urls for some tags pages
- Permalinks (don’t kill me) refuses to work..Yes, it results in a 404
- Multiple URL rewrite rules and get every prams
- Changing permalink stops me from creating webpages
- Custom Permlinks work, regular page permalinks don’t
- Moved WordPress to other folder (Windows) WAMP = 403 Forbidden
- “post-name” Renders Using page.php, but “post-name-2” renders with single.php
- How can I get WordPress CPT archives and page templates to work with prettified permalink settings?
- Webdav with permalink in WordPress v3.3.1
- Pages included in another page and duplicate content issues for SEO
- Permalink / sub-template issue
- Ugly permalinks stopped redirecting to pretty URLs
- Problems loading stylesheet and permalinks after rebooting
- Settings > Permalinks – mod_rewrite ineffective if expression not preceded by /index.php/
- Is it possible to get a page link from its slug?
- Need help with add_rewrite_rule
- After server migration only the homepage works
- remove “index.php” from permalinks
- where is permalink info stored in database?
- Changing permalinks gives me 404 errors on nginx
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Change media item permalink
- Get Permalink without domain (i.e. get relative permalink) [duplicate]
- Strange permalink issue: can’t rename /company-2/ to /company/
- Passing and retrieving query vars in wordpress
- Get the current page URL (including pagination)
- Stop WordPress appending `-2` to the end of my url after i change it
- Get default permalink structure from pretty URL’s
- How to get permalink and title from post ID?
- Why is “/page/2/” not working?
- WordPress Permalinks not working in Apache2 Ubuntu 14.04
- Performance of my permalink structure?
- Permalink format: singular or plural
- What is the difference between get_post_permalink and get_permalink?
- WordPress matching URLs with trailing tildes
- Get current URL (permalink) without /page/{pagenum}/
- How does WordPress handle permalinks?
- Pretty permalinks for search results with extra query var
- Get page permalink without wpurl
- How can I get the privacy policy page?
- Can I use REST-API on plain permalink format?
- WordPress slug issue with non-latin characters
- Rewrite Rule for Multilingual Website, Like qTranslate?
- How to get pretty URLs with add_query_arg in permalinks
- What is the best permalink structure for SEO?
- Change author permalink
- Creating custom permalink structure for languages
- Hide permalink and preview button and link on custom post
- Custom post type permalink endpoint
- How can I make Capital letter ( upper-case ) permalinks?
- How can I reverse engineer a Permalink to Find the Page?
- Mapping Domains to Permalinks (not multisite)
- How to remove dates from existing permalinks?
- How do I set a custom base URL for standard posts?
- Removing Parent Page(s) from Permalink
- Why permalinks work with /index.php/%postname% but not with just %postname%?
- Setting up WordPress with Custom Permalinks and no .htaccess File?
- Getting the Site URL Including the Front Base
- Does WordPress Change the .htaccess File When Updating?
- Using $_GET variables in the URL?
- Removing the redirect after changing a page’s slug
- How to display a public profile page for registered users with custom slug?
- Removing leading zeros from custom permalink structure
- Must slugs be unique?
- Setting 404 page in Nginx
- How to get the clean permalink in a draft?
- How to use relative links on my pages?
- How does wordpress keep track of post id when post id is not used in permalinks?
- How to filter to output of the get_permalink() function
- Stop WordPress from reserving slugs for media items?
- Including category-base in a post permalink results in 404
- How to change ‘with_front” key from an existing custom post type?
- Change slug on post creation
- Does WordPress automatically do 301 redirect if I change permalink
- How can I store page ID in a post instead of other selected permalink?
- WordPress Permalink changes to question mark (?) in URL
- WordPress thinks my custom route is a 404
- Prevent WordPress from abbreviating-long-slugs…-in-the-admin
- Adding another word in front of post url