Looks like you have your if doing the opposite of what you want. You’re returning the unaltered link if you’re on ‘furniture-type’ or ‘pop-tags’.
This should work:
function hf_remove_slug( $post_link, $post, $leavename ) {
if(('pop-tags' == $post->post_type || 'furniture-type' == $post->post_type) && 'publish' == $post->post_status) {
$post_link = str_replace( "https://wordpress.stackexchange.com/" . $post->post_type . "https://wordpress.stackexchange.com/", "https://wordpress.stackexchange.com/", $post_link);
return $post_link;
}
return $post_link;
}
Related Posts:
- Taxonomy page returns 404 page not found
- Prepend meta_value to permalink of post
- Removing CPT slug from URL results in 404 error for archive page
- Getting Post ID from slug during init
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- Rewrite rules for custom post type slug
- Change custom post type slug from plugin options
- Rewrite post type slug only for child theme
- Custom rewrite url category
- Index page with the same id as the slug
- How can I make the slug of the taxonomy also the slug of the custom post
- Programmatically rewriting slug through functions.php but returns 404
- Including taxonomy term before post type breaks top level pages
- WordPress Custom Post Type – Rewrite Query
- Custom Post Type Advanced Slug
- Custom Post Types and Removing Slugs – should we do it?
- Custom rewrite rule based on other custom post type title
- Custom Post Type not using correct page template
- Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?
- Two CPT: one is using part of the custom rewrite slug from the other
- Custom Post Type Rewrite Rule
- Custom Post Type with multiple Custom Taxonomies / Hide Taxonomy Slug from URL
- Custom post type Premalinks main page and details page
- Custom slugs with dates & IDs on Custom Post Type
- Add post id to url instead of WordPress default -2 suffix
- Custom Post type & Taxonomy URL structure
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Combining Multiple Taxonomies in one URL
- Slug for custom post type archive
- Change page /2 to /transcript with a Rewrite
- Permalink rewrite with custom post type and custom taxonomy
- Custom Post Type – Same Post Name, Different Post Type
- How would I leverage custom Taxonomies in this scenario?
- Priority for Categories, Tags, Taxonomies, Posts, Pages and Custom Posts with same url
- How to create download links based on Custom Fields with Rewrite API
- Get slug to point to different content of the same post
- Is slug “type” reserved and can’t be used in taxonomy rewrite?
- Custom Post Type get_post_type_archive_link( $post_type ) returns false
- Using custom post type parent as slug
- Permalinks when filtering multiple custom post types by single taxonomy
- custom taxonomy archive by year
- 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
- Custom taxonomy in URL showing 404
- Rewrite slug of custom post type to include post-id
- 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
- Custom Post Type with Same Page URL
- WordPress custom post type split into pages
- Correct procedure for advanced permalinks
- Custom Post Types hierarchy and rewrite
- How to get list of taxonomy slugs ordered parents>childs?
- Rewrite Endpoints and CPTs – How to use in a plugin
- Custom Post Type – Duplicate Page Slugs
- Custom post type’s permalink adds the name of the post type before the post name
- Custom taxonomy and post type with same slug
- How to make a posttype show under a page hierarchy (example.com/page/posttype/entry)?
- How to add current custom taxonomy slug to body class
- I can’t access custom taxonomy page listing
- Why WordPress is picking archive.php instead of page.php?
- Combine multiple CPT names to create valid permalinks
- 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?)
- rewriterule not working
- Custom Post Type View Button in Admin Gives 400 Error
- How to controll the Posts post type and general wondering about WP data structure
- Custom Post Type URL Rewrite’s
- restricting custom rewrite to just one custom post type
- How do I set a post slug automatically based on taxonomy?
- Rewrite URL for CPT to domain/post-name/post-id
- 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?
- CPTs relationship
- Rewrite url for custom post type with specific url
- Customise Permalink Structure For Custom Post Types
- How to make “single post” permalink maintain it’s sub-page structure
- Custom post type post_type_link gives “page not found” on any other custom post type
- Problem to get the link of the default ‘post’ post type like the orther custom types
- Can I override the permalink/slug on creation
- Rewrite Endpoint Url without ? before endpoint
- How Can a CPT in WordPress have a page 2 without an error?
- Get the custom post type slug but remove the rewrite prefix?
- Rewriting archive page slug to be different than custom post type slug
- Remove sequential number from permalinks
- custom post type archive slug vs. custom page template
- Parent cpt/child custom post type URL permalink relationship
- How to make nested custom post type slugs work
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- How to rewrite custom slugs that follow my rules
- What is the best way to relate different custom post types?
- Allow child pages with the same base as the CPT slug
- Custom Post Type slug has the same Redirection entry