Post types continue to be selected after removal from custom taxonomy registration
|Reported by:||jondavidjohn||Owned by:||jondavidjohn|
Post's appear in the archive view for custom taxonomies that have post types that are not registered for the given custom taxonomy.
This happens when a post type is removed from the taxonomy registration that currently has posts with said post type with associated taxonomies applied. It doesn't seem like it should be assumed that taxonomy registration will always be handled in a static programmatic way that will never change.
- Create a custom taxonomy registration for 'post' and 'page' post types
- Add a few posts and pages to one of these custom taxonomies
- Check and make sure these posts/pages are showing up on the custom taxonomy archive page
- Now remove 'page' from the taxonomy registration
- Confirm that it is removed in the admin menus and page edit screen.
- Go back to the taxonomy archive page and you will see the pages you added still show up in the loop, now unable to manually remove the taxonomy term in the admin.
Currently the query for a custom taxonomy defaults to 'any' post type with the taxonomy applied, if a post type has not been filtered in at this point. (query.php:2217)
My proposed solution would be to recognize the taxonomy applied and use the post type registration to make the default post type selection, instead of assuming 'any'.
This will prevent the situation of orphaned posts still showing up in custom taxonomy archives even after their post type is removed from the registration.
Change History (38)
comment:16 nacin — 13 months ago
- Keywords revert added; has-patch commit removed
- Priority changed from normal to high
- Resolution fixed deleted
- Severity changed from normal to blocker
- Status changed from closed to reopened
comment:19 nacin — 13 months ago
- Keywords close added; revert removed
- Priority changed from high to normal
- Severity changed from blocker to major