Account for old type=link (now taxonomy=link_category) in wp_dropdown_categories(). Don't use the deprecated argument in options-writing. Sprinkle in some deprecated warnings. fixes #12630

git-svn-id: http://svn.automattic.com/wordpress/trunk@13754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-03-18 20:17:15 +00:00
parent 30c1e595ad
commit 3bdcf36888
3 changed files with 12 additions and 2 deletions

View File

@ -52,7 +52,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'o
<th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
<td>
<?php
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'type' => 'link'));
wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'taxonomy' => 'link_category'));
?>
</td>
</tr>

View File

@ -318,6 +318,7 @@ function category_description( $category = 0 ) {
* 'id' (string) - The ID attribute value for select element. Defaults to name if omitted.
* 'class' (string) - The class attribute value for select element.
* 'selected' (int) - Which category ID is selected.
* 'taxonomy' (string) - The name of the taxonomy to retrieve. Defaults to category.
*
* The 'hierarchical' argument, which is disabled by default, will override the
* depth argument, unless it is true. When the argument is false, it will
@ -345,6 +346,12 @@ function wp_dropdown_categories( $args = '' ) {
$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
// Back compat.
if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
_deprecated_argument( __FUNCTION__, '3.0', '' );
$args['taxonomy'] = 'link_category';
}
$r = wp_parse_args( $args, $defaults );
if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {

View File

@ -42,8 +42,11 @@ function &get_categories( $args = '' ) {
$taxonomy = apply_filters( 'get_categories_taxonomy', $args['taxonomy'], $args );
if ( isset($args['type']) && 'link' == $args['type'] ) //Back compat
// Back compat
if ( isset($args['type']) && 'link' == $args['type'] ) {
_deprecated_argument( __FUNCTION__, '3.0', '' );
$taxonomy = $args['taxonomy'] = 'link_category';
}
$categories = (array) get_terms( $taxonomy, $args );