Allow register_taxonomy() to be called before init for back compat with impatient plugins.
git-svn-id: http://svn.automattic.com/wordpress/trunk@7545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2b93618c82
commit
a480e4e55b
|
@ -158,14 +158,14 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
|
||||||
$defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
|
$defaults = array('hierarchical' => false, 'update_count_callback' => '', 'rewrite' => true, 'query_var' => true);
|
||||||
$args = wp_parse_args($args, $defaults);
|
$args = wp_parse_args($args, $defaults);
|
||||||
|
|
||||||
if ( false !== $args['query_var'] ) {
|
if ( false !== $args['query_var'] && !empty($wp) ) {
|
||||||
if ( empty($args['query_var']) )
|
if ( empty($args['query_var']) )
|
||||||
$args['query_var'] = $taxonomy;
|
$args['query_var'] = $taxonomy;
|
||||||
$args['query_var'] = sanitize_title_with_dashes($args['query_var']);
|
$args['query_var'] = sanitize_title_with_dashes($args['query_var']);
|
||||||
$wp->add_query_var($args['query_var']);
|
$wp->add_query_var($args['query_var']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( false !== $args['rewrite'] ) {
|
if ( false !== $args['rewrite'] && !empty($wp_rewrite) ) {
|
||||||
if ( !is_array($args['rewrite']) )
|
if ( !is_array($args['rewrite']) )
|
||||||
$args['rewrite'] = array();
|
$args['rewrite'] = array();
|
||||||
if ( !isset($args['rewrite']['slug']) )
|
if ( !isset($args['rewrite']['slug']) )
|
||||||
|
|
Loading…
Reference in New Issue