The problem is with the rewrite rules generated with the post type- they’re a bit greedy and are capturing those requests. WordPress is trying to query for a matching category_type
, which isn’t actually an object type, and in the absence of any other valid query argument, it runs the main blog query.
You could manually generate the post type rewrite rules in a way that is less greedy, or you can add a rule that just overrides them in the case where ARTICLE_NAME
isn’t present:
add_rewrite_rule(
'^community/articles/([^/]*)?/?$',
'index.php?pagename=community/articles/$matches[1]',
'top'
);
When dealing with rewrites, I recommend the Monkeyman Rewrite Analyzer plugin, which will give you a new menu item in admin under Tools where you can plug in URLs and see how they are matching to rewrite rules and parsing to query vars.
Related Posts:
- Custom permalink rewrite rules – how do I fix this?
- Redeclare/Change Slug of a Plugin’s Custom Post Type
- Custom Post type & Taxonomy URL structure
- Slug Formatting : Acceptable Characters?
- Disable permalink on custom post type
- Combining Multiple Taxonomies in one URL
- Change slug of registered custom post type in child theme
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- How to achieve this permalink -> category-name/custom-post-type-name/post-name
- Make permalinks based on an ACF-field
- ACF Relationships in Custom Post Type Permalink
- Prepend meta_value to permalink of post
- Remove Slug from Custom Post Type results in 404
- Remove taxonomy slug when not assigning taxonomy with custom post types
- Can’t edit Custom Post Type slug/permalink
- Remove Taxonomy Slug when No Taxonomy is Assigned to Custom Post Type?
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Custom Taxonomy breaking pages permalinks
- How to Display ACF Relationship Custom Field as Link to Specific Custom Post?
- Custom Post Type with two hierarchical Custom Taxonomies: strategy to generate best permalink structure
- Automaticly add slug to posts
- How do I fix permalinks for custom post types that has the same slug as a page?
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Why does wordpress keep adding postname to my CPT’s permalink in the end?
- Wrong generated page_name/slug on first publish of custom post type
- Remove post type slug of all post types from permalinks
- Stop / prevent WordPress from updating permalinks of custom post type
- Change custom post type slug from plugin options
- Child post with numeric only slug keeps redirecting to parent
- How to add a post slug to a url?
- Permalink for a custom post type isn’t working and I don’t know why
- How to target a specific custom post type post and its all children and grandchildren?
- Assign same parrent Page to pages AND custom post types
- Create a custom php page and load it at a specific slug
- CPT archive admin menu label
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- How to change permalink to include custom post type
- Custom Post Type – Duplicate Page Slugs
- Redirect to another page using contact form 7? [closed]
- Remove permalink for custom post type
- How do you create %post_type%/%postname%/ permalink structure?
- Change Slug of a Custom Post Type
- How to inherit field value from parent post into in child / sub post
- Create short URL with auto 301 redirect
- Custom Post Type Advanced Slug
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Custom Post Type to replace Woocommerce products – page not found error
- Custom Post Type with Configurable Sidebar via ACF
- Need to return a string as permalink insted of str_replace
- Under What Conditions Can I name my CPT the same as my CPT Page?
- Excerpt length: get first paragraph
- Custom post ID & display information related to this ID
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- WordPress URL rewrites using Advanced Custom Field
- Change permalink incrementor into pseudo-subdirectory
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Two CPT: one is using part of the custom rewrite slug from the other
- Post Custom & Taxonomy 404 error
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Can I override the permalink/slug on creation
- Get full control over custom post type url
- Add category slug as class attribute in a link array
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Get post id of permalink for a specific custom post type?
- Can’t make permalink of CPT work
- How to make nested custom post type slugs work
- Can’t preview custom post – Redirected to home page
- How to I add count of custom posts listed in a post as a prefix to its title
- Hide custom post type slug url from search engine [closed]
- Custom post type Premalinks main page and details page
- Is it possible to use a post name in a custom post slug?
- How to change permalink structure off default posts and also CPT’s posts
- How to get the proper category in permalink with custom post type assigned to multiple categories
- How to get taxonomy category in permalink for each taxonomy OR How to give a parent page to a given taxonomy?
- How to change post featured image using a custom field of category?
- post_type_link not working in gutenberg
- wp_insert_post generates endless posts
- Remove standard meta boxes from custom taxonomy
- Custom template won’t load for a custom post type (custom permalinks used)
- Validate custom fields before save using WordPress Rest API
- Making a custom help center page
- get_posts of Custom Post Type AND Custom Taxonomy
- What’s the difference between same wp functions get_posts(); functions in different form?
- Custom taxonomy in URL showing 404
- I did group my search results by post type, but how can i give each of them its own order?
- Dequeue scripts and styles only for specific custom post type
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- Custom post type and permalink issue
- Function to display custom post type on front page makes menu items dissapear
- How do I correct an incorrect permalink?
- How can I update the permalink everywhere for a custom post type?
- Update permalinks when new category added to custom post type taxonomy
- custom post type not showing in menu
- Append date to custom post type url slug
- Add archive slug to default post post type
- Custom Post type and permalink settings
- Show category ID on custom post type
- Custom fields vs. Custom post types for a Portfolio Website
- Custom rewrite rule for hierarchical custom post type