Allow register_taxonomy() to be called before init for back compat with impatient plugins.

git-svn-id: https://develop.svn.wordpress.org/trunk@7545 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-03-27 06:30:20 +00:00
parent ff06c87a84
commit 8bb8033d6c
1 changed files with 2 additions and 2 deletions

View File

@ -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']) )