Permalink
Browse files

Reduce calls to sanitize_title_with_dashes in register_(post_type|tax…

…onomy). Props ocean90. fixes #21600

git-svn-id: http://core.svn.wordpress.org/trunk@21553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 9eeccc2 commit 9dbb6a34f642db24df5aced99b867c336a5809cb Ryan Boren committed Aug 20, 2012
Showing with 4 additions and 2 deletions.
  1. +2 −1 wp-includes/post.php
  2. +2 −1 wp-includes/taxonomy.php
@@ -1042,7 +1042,8 @@ function register_post_type( $post_type, $args = array() ) {
if ( false !== $args->query_var && !empty($wp) ) {
if ( true === $args->query_var )
$args->query_var = $post_type;
- $args->query_var = sanitize_title_with_dashes($args->query_var);
+ else
+ $args->query_var = sanitize_title_with_dashes($args->query_var);
$wp->add_query_var($args->query_var);
}
@@ -331,7 +331,8 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
if ( false !== $args['query_var'] && !empty($wp) ) {
if ( true === $args['query_var'] )
$args['query_var'] = $taxonomy;
- $args['query_var'] = sanitize_title_with_dashes($args['query_var']);
+ else
+ $args['query_var'] = sanitize_title_with_dashes($args['query_var']);
$wp->add_query_var($args['query_var']);
}

0 comments on commit 9dbb6a3

Please sign in to comment.