So the problem was in the custom rest route which had the call to flush_rewrite_rules()
which (as far as I can see) resetted the permalinks to default somehow and messed up the permalink structure.
Once we removed all the calls to the custom route no 404 happened.
Related Posts:
- Templates for Custom Post Types and Custom Taxonomies
- Flush Rewrite Rules when new site is created on network
- Custom Post Type Permalink / Rewrite not working immediately
- How to remove /blog/ prefix for custom post types in permalinks?
- Custom Post Type Permalink Page Not Found
- WordPress Custom Post Type is Matching on Partial Slug
- Changing the URL Structure of a Paginated Custom Post
- Change slug of registered custom post type in child theme
- Custom permalinks
- Permalink for CPT with taxonomy
- Understanding Permalinks on Custom Post Types
- Custom post type permalink changing itself every other change
- Add links to post categories and taxonomies in wysiwyg link modal?
- Custom Permalinks for Custom Post Types and Taxonomies
- Removing parent slug from URL on custom post type
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Custom post type category, taxonomy and URL rewrite problem
- Rewrite on custom post type permalink not working?
- Custom Post Type: How to display all of same taxonomy?
- Custom post type permalink missing /post_type/ front
- Remove POST_TYPE from custom post type permalink
- Remove “-2” from a Toolset Types URL with the same post name
- Custom post types and permalink
- Multisite with a single, shared custom post type, while retaining site URL
- custom post type default permalink
- Programmatically adding posts
- Custom post types, taxonomies, and permalinks
- How to specify URLS for custom posts & taxonomies
- Permalinks not working for custom taxonomy on custom post type
- Custom rewrite rule for hierarchical custom post type
- Custom Post Type permalink shows wrong page: homepage/index.php
- Get term name and term parent into custom post type permalink
- Rewrite rules for custom posts types
- Does WordPress consider a post name unique if that same post name is in multiple Post Types?
- Custom post type url with category
- Adding custom post category slug in permalink causes 404 error for pages and posts
- Custom post type as home page with custom url
- URL rewrite add author as base
- Custom Post Type Permalink empty
- Displaying All Posts of a Custom Post Type in WordPress Multisite Backend
- Multiple pages for posts?
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- CPT’s with landing page instead of archive – Url Rewrite?
- Hierarchical permalinks for custom post type and taxonomy
- How to organize hierarchical structure in custom post type with taxonomy (like with categories)
- Form action doesn’t work if slug isn’t same as custom post title
- Custom Post Type – Duplicate Page Slugs
- Remove permalink for custom post type
- Best way to specify “article type” in URL
- Template files for Custom Post Type and Taxonomy
- How to have permalink like domain.com/term/postname?
- Custom post type permalink returns 404 when set to private
- Assigning alternate single-{cpt} template based on blog_id in multisite
- Custom post type slug 404
- WordPress multisite – is it possible to have different taxonomies for each site?
- How to filter a custom post type by custom taxonomy without 404
- How to migrate Custom Field Template to a WordPress Multisite
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- Custom Post Type with Configurable Sidebar via ACF
- Pagination of custom post type leads to 404 error
- Custom permalink structure for remote content pages
- WordPress Custom URLs
- Setting a homepage – doesn’t seem to work
- Adding an extra parameter [string] to my posts’ permalink?
- Custom Post Type nest under a normal WordPress Page
- Is it possible to have hierarchical taxonomy and hierarchical custom post types in one permalink?
- Permalinks not working (404) for the ‘item’ post type
- Wp PageNavi only works with default permalinks on a custom post type?
- Custom category URL not displaying posts
- Change permalink for custom post type?
- Use a different URL path / permalink for CPT
- Duplicate slug/permalink issue while adding same post name
- Preview url not working outside wp-admin
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- % encoded URL giving 404 error in WordPress
- Issue with Custom Post Types and Permalinks
- How can i remove post type archive URL?
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Links Image in “Catalog” Page to Posts
- Why does my plugin require a permalink reset after a new installation?
- How to have permalink structure based on taxonomy terms
- Custom post type permalink issue [duplicate]
- Multiple post types or single post type with category taxonomy?
- Get full control over custom post type url
- How to switch from custom post type URL to category URL?
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- Customizing the custom post type permalink
- Adding 2 CPT with multiple custom taxonomies to permalinks
- Custom Post Type permalink not working on new posts
- Storing postID in session variable to query database when visitor on custom template page
- Is it possible to remove the word “date” from archives?
- Permalink for regular posts “/blog/”
- Permalink for Custom Post Types
- Custom post type split title, setup permalink accordingly
- How to get permalink of post based on post name?
- Multiple custom post type in URL
- Two Permalinks with one Taxonomy (custom taxonomy) and (custom post type -> custom taxonomy)
- Have Custom Taxonomy Slug Fall Under Custom Post Type Slug
- Custom Post Types Do Not work on this permalink setting https://somedominaname.com/%category%/%postname%/