[wp-trac] [WordPress Trac] #35227: Add unregister_taxonomy()

WordPress Trac noreply at wordpress.org
Sun Dec 27 16:23:53 UTC 2015


#35227: Add unregister_taxonomy()
----------------------------------------+------------------
 Reporter:  swissspidy                  |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  4.5
Component:  Taxonomy                    |     Version:  2.3
 Severity:  normal                      |  Resolution:
 Keywords:  has-unit-tests needs-patch  |     Focuses:
----------------------------------------+------------------
Changes (by boonebgorges):

 * keywords:  early has-patch has-unit-tests dev-feedback => has-unit-tests
     needs-patch


Comment:

 @swissspidy A few thoughts, in no particular order:

 - Docblock description for `WP_Rewrite::remove_rewrite_tag()` is copied
 from `add_rewrite_tag()` and needs to be updated.
 - After unsetting array values in `remove_rewrite_tag()`, we could have
 gaps in the numerical array keys (ie: 0, 1, 3, 4). Does this matter? Worth
 resetting indexes using `array_values()` after `unset()`ing?
 - Personal preference, but I'd say that with a new function (and no
 backward compatibility concerns) we should be returning descriptive
 `WP_Error` objects on various failures in `unregister_taxonomy()`.
 - Between this ticket and #14761, it's probably worth adding a
 `WP::remove_query_arg()` helper.
 - Similarly, I'd prefer a `remove_permastruct()` method to reaching into
 `$wp_rewrite`'s public properties.
 - `register_taxonomy()` adds a specific callback to `'wp_ajax_add-' .
 $taxonomy`, but when unregistering, you `remove_all_actions()`. Perhaps
 it's wiser to be conservative here and only undo the specific
 `add_action()` from `register_taxonomy()`.
 - In the test suite, don't remove `_unregister_taxonomy()`. Just make it a
 wrapper. Plugins are using it.

 Looks like you have pretty well covered the various pieces of
 `register_taxonomy()` aside from these issues.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35227#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list