At @milo’s suggestion, I used the post_type_link example and adapted it to my needs. This made it so only my chosen post type would be relative, while leaving any other custom post types functioning as usual.
function make_yourposttype_relative ( $url, $post ) {
if ( 'yourposttype' == get_post_type( $post ) ) {
add_filter( 'post_type_link', 'wp_make_link_relative' ); // Custom post type link
add_filter( 'post_type_archive_link', 'wp_make_link_relative' ); // Post type archive link
}
return $url;
}
add_filter( 'post_type_link', 'make_yourposttype_relative', 10, 2 );
Related Posts:
- Custom Post Type URL Rewriting?
- Add .html (dot HTML) extension to custom post types
- Multiple post types – share same ReWrite slug?
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Custom post types – Use post_id in permalink structure when using has_archive => true
- How to modify URL structures in custom post types and taxonomies or terms
- Slug for custom post type archive
- Change page /2 to /transcript with a Rewrite
- Permalink rewrite with custom post type and custom taxonomy
- Make permalinks based on an ACF-field
- How would I leverage custom Taxonomies in this scenario?
- WordPress returns 404 on custom rewrite rule conflict in parameters
- How to create download links based on Custom Fields with Rewrite API
- How to rewrite custom post type URL for multiple depths instead of one specific depth
- Regex problem in an add_rewrite_rule
- Multiple Permalinks for custom post type post
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- WordPress Rewrite rule for nested post types
- Category base to url in custom post type/taxonomy
- Is slug “type” reserved and can’t be used in taxonomy rewrite?
- Custom Post Type get_post_type_archive_link( $post_type ) returns false
- Permalinks when filtering multiple custom post types by single taxonomy
- custom taxonomy archive by year
- How to Combine Two Custom Post Types into Single Permalink Structure
- Redirecting when changing custom post type slugs?
- How can you handle rewrite rules for custom post types with option to filter on custom taxonomy terms?
- Conditional regex in add_rewrite_rule() for specific query filters & pagination
- How to remove slugs from multiple custom post types
- Displaying Posts of a Custom Type
- Can’t change first part of URL rewrite for custom post type
- CPT Archive with core Category
- Custom taxonomy in URL showing 404
- Rewrite slug of custom post type to include post-id
- Rewrite rules for custom posts types
- Custom Post Types, URL rewrite on multiple CPTs
- How to change custom post type permalink structure
- Front custom edit post page for each post
- Categories of Custom Post throws gives 404
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- Rewrite Question Mark in Post Template to Make it Pretty URL
- Index page with the same id as the slug
- Custom post type as home page with custom url
- How to rewrite url for any specific taxonomy?
- Custom post URL 404 error
- URL rewrite add author as base
- WordPress custom post type split into pages
- Including taxonomy term before post type breaks top level pages
- Correct procedure for advanced permalinks
- Custom Post Types hierarchy and rewrite
- CPT’s with landing page instead of archive – Url Rewrite?
- How to get list of taxonomy slugs ordered parents>childs?
- Rewrite Endpoints and CPTs – How to use in a plugin
- Custom post type’s permalink adds the name of the post type before the post name
- Custom taxonomy and post type with same slug
- Permalink misbehaving in Custom Post Types
- I can’t access custom taxonomy page listing
- Combine multiple CPT names to create valid permalinks
- Add term slug in URL of custom post type details page
- Programmatically add custom field to post_name in a custom post type
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- How to create custom search result page with custom URL parameters for custom post type?
- Page inside custom post type (url rewrite?)
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- How to constrain the results to a specific post_type on tag archive page?
- rewriterule not working
- Modifying rewrite rules to use /category//
- Custom Post Type View Button in Admin Gives 400 Error
- Custom Post Type URL Rewrite’s
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- restricting custom rewrite to just one custom post type
- returning the currect URL for nested posts
- 404 error rewrite permalinks
- Rewrite URL for CPT to domain/post-name/post-id
- Custom rewrite rule based on other custom post type title
- How to apply multiple rewrite_rule to a single custom post type url?
- Custom permalink structure for custom post types including multiple taxonomy
- How can I assign multiple parents to CPT?
- Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?
- Rewrite url for custom post type with specific url
- How to make “single post” permalink maintain it’s sub-page structure
- Custom Post Type canonical link / pagination redirecting to root
- Rewrite url post_tag for custom post type
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- Two CPT: one is using part of the custom rewrite slug from the other
- WordPress custom post type rewrite rule matches all pages returning 404
- Rewrite Endpoint Url without ? before endpoint
- How Can a CPT in WordPress have a page 2 without an error?
- current_menu_parent for custom post type and custom url
- Remove sequential number from permalinks
- Parent cpt/child custom post type URL permalink relationship
- Custom post type and custom taxonomy archive inaccessible
- Custom Post & Taxonomy rewrite break regular post & page
- Custom slugs with dates & IDs on Custom Post Type
- Add post id to url instead of WordPress default -2 suffix
- Custom URLs between different post types, using “Pods”
- CPT with URL rewrite showing as 404
- How to add random prefix (based on related page slug) to custom post type?
- Rewrite taxonomy permalink appended to CPT archive url