Okay so I have resolved this by combining several different wordpress functionalities:
- Catches the template include conditionally
add_filter( 'template_include', '...' );
, in my case based on a regex match of the expected URI pattern locate_template('example-template.php')
to then resolve my (essentially) static template- A query within my
example-template.php
that externally retrieves the resource - This must handle 404s interally as the response will always assume the post can’t be found, I am always setting the header response (before
get_header
in the template to202
where the resource is found. - Example;
if ($resource) { @header($_SERVER['SERVER_PROTOCOL'] . ' 202 Accepted', true, 202); }
Bit convoluted, but really not too much work for what I required.
Related Posts:
- how to use two permalinks for one custom post type
- Clean URL permalink for custom post type
- WordPress custom post type permalink rewrite shows page not found
- Using page title as a link to term archive
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- News post with multiple permalinks? When opened from different page
- Dynamically change Custom Post Type Template OR Change Permalink?
- PHP Button Custom link [closed]
- Possible for Category Base and Custom post Type to share the same slug/permalink?
- WP_Query is printing out only one post when posts_per_page is set to multiple
- WP Query to displaying date and posts for that date?
- GravityForm: Populate Dropdown with custom post type [closed]
- Return array of categories to php function for current post
- How do I get the permalink structure to work like this?
- Link users to a custom post type
- Create a random unique 6 digit number as custom field for custom post type
- How to output wordpress custom tags separated by comma?
- Loading all files within a directory
- Different permalink for CPT and regular Posts/Pages but why?
- Custom fields in Permalinks?
- Blog page showing same content as homepage
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- How do I fix permalinks for custom post types that has the same slug as a page?
- Custom post type, permalinks & pagination, going wrong
- Using several custom fields as custom post title
- Custom Post Type without an archive page
- How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?
- Change URL of posts and also Custom Post Type
- Get rewrite slug of custom post type in template
- Show Different Header on a Specific Post ID
- Custom post type template and custom post page not working
- Get Post Primary Category
- Weird problem happening with custom taxonmy when creating/updating posts
- A good strategy to print custom posts (offer) that are checked inside the metabox of a post?
- Admin notice not displaying
- Permalinks not working for custom taxonomy on custom post type
- remove permalink “front part” for custom post type
- Can’t get order_by meta_value_num to work properly
- Permalink Structure CPT With Custom Taxonomy Fails
- Parent & Child Taxonomy slugs in custom post permalink
- Create custom post type on successful woocommerce order [closed]
- Adding custom tables to WordPress
- Custom Post Types and independent Categories – complex Taxonomy
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Change Permalink Structure for Tag.php template
- Removing parent slug in hierachial custom post type
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Very Slow Page – How to Optimize # of Queries?
- Easy way to change custom post type name for permalinks?
- Dynamic page outside WordPress
- Custom post type permalinks
- Use different taxonomies in different custom post types’ permalinks?
- Using wordpress template tags within an array
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- custom permalinks based on taxonomies for custom post type
- Getting the URL of the parent page
- Why does wordpress keep adding postname to my CPT’s permalink in the end?
- Custom query to filter posts that have current post as a taxonomy [closed]
- Custom post type permalink returns bad url
- post_type_link not working in gutenberg
- Return the thumbnail meta data for getter and setter
- Wrong generated page_name/slug on first publish of custom post type
- Remove post type slug of all post types from permalinks
- Custom template won’t load for a custom post type (custom permalinks used)
- How to display selected taxonomies by their parent
- Custom Field Order by Last Name and First Name
- Making a custom help center page
- Pagination for custom php code
- get_posts of Custom Post Type AND Custom Taxonomy
- Stop / prevent WordPress from updating permalinks of custom post type
- What’s the difference between same wp functions get_posts(); functions in different form?
- Custom taxonomy in URL showing 404
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Custom post type and permalink issue
- How do I correct an incorrect permalink?
- Custom Post Type Loop throws 500 error when used in widget
- how to check if custom post type column already exists?
- How can I update the permalink everywhere for a custom post type?
- Update permalinks when new category added to custom post type taxonomy
- Get posts from a custom post type by child categories of a parent category
- Add archive slug to default post post type
- Received nothing after executing AJAX post function
- Custom Post type and permalink settings
- How to make sure content doesn’t display if selection is empty
- Custom Post-Type not in admin menu
- get the custom post type title/name
- Page vs Custom Post Types Differences/Issues
- If post has custom field then display css-class
- Push metadata in array
- Custom rewrite rule for hierarchical custom post type
- How to customize a permalink (URL) structure?
- Troubles with saving metabox
- CPT + CMB2: data not displaying for only first post in loop
- How to make a field appear only if a post meta field has a defined value?
- Replace text in post from cvs
- Get parent categories of custom post type
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Can I list a custom post type within another custom post type in the admin area?
- Get custom post type list for every category shortcode