From 21c4e3e30ec3522ab38b811b5a0d532fb7f94f8f Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 18 Mar 2010 20:17:15 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@13754 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/options-writing.php | 2 +- wp-includes/category-template.php | 7 +++++++ wp-includes/category.php | 5 ++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index 3059cf2a06..dbcc1e59a2 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -52,7 +52,7 @@ wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'o 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')); ?> diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index a000988554..cb746d0a7b 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -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'] ) { diff --git a/wp-includes/category.php b/wp-includes/category.php index ee3d9432ee..1f66518536 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -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 );