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/
- What is the difference between get_post_permalink and get_permalink?
- WordPress matching URLs with trailing tildes
- How to use relative links on my pages?
- How to filter to output of the get_permalink() function
- Is there a user-facing interface to edit an attachment’s permalink?
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Get post title with link
- Menu Link Redirect Based on Username or User ID
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- Enable Minify in W3Total Cache using NGINX [closed]
- Why I can’t change the permalink of this page?
- Sub-category and category in permalink structure
- Permalinks changed with WordPress 4.9
- Permalinks broken regularly
- Changing post content on save, using updated fields
- Change blog segment of URL
- Change in permalink structure made javascript cookie not work correctly
- Multiple taxonomies on same permalink rule [closed]
- How to bulk edit image url in featured image and product description?
- What’s actually happening when permalinks for custom post types suddenly stop working
- Conditional permalink structure
- Auto setup “permalink” or request notice
- How to add .html to the end of the permalink
- permalinks issue and archives
- get_permalink() always returns empty
- Separate link structure for specific posts (/blog/glossary in stead of just /blog)
- WordPress basic functions show on top in custom shortcode
- Is it possible to install WordPress Multisite on a subdomain with subdirectories?
- Internal linking when on a shared IP
- How can I redirect this contact form to a specific permalink
- Change permalink structure for pagination only
- http: not showing in wordpress permalink setting
- Two URLs of one post is available
- Remove all stop words from old permalinks
- 404 error on all pages but custom post types are working OK
- using wp_redirect to redirect to a permalink
- old permalinks not found
- WordPress permalink from the database?
- Can I change the URL structure for a CPT only?
- Display parent page URL for child page
- Make a post inaccessible without a unique ID in the URL
- Code snippet to add filter pre_post_link to change Media URL (post_type attachment permalink/slug)
- Change permalink structure in all sites of a multisite
- Make query parameter an endpoint
- Added a prefix in URL permalink structure but the old structure still working!
- Permalink of post redirect to uncategorized category
- Force/Limit the post/page slug to accept only url friendly characters
- Make Permalinks have a custom format?
- Permalinks setting raises 500.0 error
- permalinks of subcategory and posts
- Define a Permalink Structure by Post and Page
- After changing permalink settings, everything works fine except for the two most recent posts
- Installing WordPress in another Install?
- using post meta data as permalink tags [duplicate]
- .htaccess not working in WordPress
- Incorporate single WordPress page into an existing static website [duplicate]
- How to configure WordPress to be a subdirectory of my main site as mymainsite.com/blog?
- Removing parent page in URL for one page
- htaccess strip url
- WordPress Permalinks 404 Not Found
- WordPress 6.1.1 UTF8 Slug Limit Increase
- 301 Redirect posts to newly added categories
- make a new structure tag that does some processing
- Website appears with wrong permalink in Google’s search