[wp-trac] [WordPress Trac] #21290: Post types continue to be selected after removal from custom taxonomy registration
WordPress Trac
wp-trac at lists.automattic.com
Mon Jul 16 19:06:14 UTC 2012
#21290: Post types continue to be selected after removal from custom taxonomy
registration
--------------------------+-----------------------------
Reporter: jondavidjohn | Owner: jondavidjohn
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 3.4.1
Severity: normal | Keywords: has-patch
--------------------------+-----------------------------
== Bug ==
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.
== Reproduce ==
1. Create a custom taxonomy registration for 'post' and 'page' post types
2. Add a few posts and pages to one of these custom taxonomies
3. Check and make sure these posts/pages are showing up on the custom
taxonomy archive page
4. Now remove 'page' from the taxonomy registration
5. Confirm that it is removed in the admin menus and page edit screen.
6. 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.
== Solution ==
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.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21290>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list