Lets say that that a post URL is https://example.com/the-post/, page URL is https://example.com/the-page/ and the category URL is https://example.com/the-category/. How does WordPress know which rewrite rule to use so It doesn’t accidently return 404, because I want to add some custom post type and custom taxonomies with no base slug e.g. https://example.com/the-custom-post/, https://example.com/the-custom-taxonomy/. How should I add the rewrite rule so It doesn’t overrules/underruled by other posts, pages and category rewrite rules and return 404 page.
I have tried many ways to add rewrite rules but they always overrule other posts, pages and categories or are underruled.