From fffd8c8e2db09f4948cc8201d5988a7b96f8407b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 16 Jan 2015 21:37:23 +0000 Subject: [PATCH] In `get_edit_term_link()`, default to a valid `$object_type`. The $object_type param is used to set the 'post_type' query var, which determines the post type menu that will be expanded when clicking through to the term edit page. Not all taxonomies are associated with Posts, so it makes sense to default to a post_type that the taxonomy is actually associated with. Props DzeryCZ, juliobox. Fixes #29251. Built from https://develop.svn.wordpress.org/trunk@31218 git-svn-id: http://core.svn.wordpress.org/trunk@31199 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 12 ++++++++---- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index ae1224bd52..06ecc8f499 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -888,9 +888,10 @@ function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { * * @since 3.1.0 * - * @param int $term_id Term ID - * @param string $taxonomy Taxonomy - * @param string $object_type The object type + * @param int $term_id Term ID. + * @param string $taxonomy Taxonomy. + * @param string $object_type The object type. Used to highlight the proper post type menu on the linked page. + * Defaults to the first object_type associated with the taxonomy. * @return string The edit term link URL for the given term. */ function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { @@ -906,8 +907,11 @@ function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { 'tag_ID' => $term->term_id, ); - if ( $object_type ) + if ( $object_type ) { $args['post_type'] = $object_type; + } else if ( ! empty( $tax->object_type ) ) { + $args['post_type'] = reset( $tax->object_type ); + } $location = add_query_arg( $args, admin_url( 'edit-tags.php' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index d964d96da0..1086ac32d8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-alpha-31217'; +$wp_version = '4.2-alpha-31218'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.