Opened 14 years ago
Closed 14 years ago
#9647 closed defect (bug) (fixed)
initial taxonomies
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.8 | Priority: | high |
Severity: | normal | Version: | 2.8 |
Component: | Taxonomy | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
In 2.7 initial taxonomies where created in wp-includes/taxonomy.php
In 2.8 initial taxonomies are created on event 'init' which appears after 'plugins_loaded' event
will propose a patch for this !
Attachments (4)
Change History (17)
#3
@
14 years ago
Passing variable to __() will pollute the translation catalog.
Plugins should never do anything before init. Since we accidentally allowed registering taxonomies before init, we can try having registration calls made before init delay registration until init fires, but this can still result in plugin added taxonomies not having properly translated strings.
#4
follow-up:
↓ 5
@
14 years ago
@Ryan: couldn't the load_default_textdomain() call be moved further up? Is there any specific reasons for placing it so low in wp-settings.php?
#5
in reply to:
↑ 4
;
follow-up:
↓ 6
@
14 years ago
@Ryan, @Denis-de-Bernardy : agree with all your comments,
- about register_taxonomy() : + should initialize $wp_taxonomies if not set
if (!is_array($wp_taxonomies)) $wp_taxonomies = array();
+ maybe adding following test
if (isset($wp_taxonomies[$taxonomy])) return;
- about #9399 patch, + create_initial_taxonomies() should use register_taxonomy(). + add_action( 'init', 'create_initial_taxonomies' ); should have the highest priority to be executed before any other add_action( 'init' ...
- about wp-settings.php + load_default_textdomain() should be moved further up in wp-settings.php (apparently only needs constant WP_LANG_DIR). + maybe create_initial_taxonomies() code should be in wp-settings.php and we would get rid of the "add_action( 'init', 'create_initial_taxonomies' );" .
I am still a bit concerned about existing plugins that are doing things on wordpress "plugins_loaded" event. They could even define some new taxonomies that will be erased by the #9399 patch's "add_action( 'init', 'create_initial_taxonomies' );" .
#6
in reply to:
↑ 5
@
14 years ago
Replying to arena:
I am still a bit concerned about existing plugins that are doing things on wordpress "plugins_loaded" event. They could even define some new taxonomies that will be erased by the #9399 patch's "add_action( 'init', 'create_initial_taxonomies' );" .
I use that hook in a Fixes plugin, that moves plugin hooks around depending on which plugins are loaded. Else there really isn't much use for it. (And even less use for the mu_plugins_loaded hook.)
#7
@
14 years ago
Here attached is a patch 9647_2.diff replacing the previous ones.
- register_taxonomy() : as following tests added
if (!is_array($wp_taxonomies)) $wp_taxonomies = array();
if (isset($wp_taxonomies[$taxonomy])) return;
- create_initial_taxonomies() using register_taxonomy()and add_action( 'init', 'create_initial_taxonomies', 0); with the highest priority.
I think load_default_textdomain() to be moved further up should be delayed to a next release, new ticket !
#8
@
14 years ago
Looks good. We should still encourage waiting for init to register, but this will preserve old behavior.
#10
@
14 years ago
Is this check truly needed?
if (isset($wp_taxonomies[$taxonomy])) return;
I'm itching to open a ticket along the lines of "register_taxonomy() should allow to override a default taxonomy".
the 2.8 changes was introduced by #9399 for a translation issue ...