From d99f9d3a22281e460286d8959e0a00055298e832 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Fri, 26 Jun 2015 14:13:24 +0000 Subject: [PATCH] Improve error checking in `get_edit_term_link()`. The function should not throw notices when an improper term or taxonomy is passed. Props tmatsuur, MikeHansenMe. Fixes #32786. Built from https://develop.svn.wordpress.org/trunk@32954 git-svn-id: http://core.svn.wordpress.org/trunk@32925 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 8 ++++++-- wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 9df41fbee8..c58ee26d0f 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -903,14 +903,18 @@ function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) { * @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. + * @return string|null The edit term link URL for the given term, or null on failure. */ function get_edit_term_link( $term_id, $taxonomy, $object_type = '' ) { $tax = get_taxonomy( $taxonomy ); - if ( !current_user_can( $tax->cap->edit_terms ) ) + if ( ! $tax || ! current_user_can( $tax->cap->edit_terms ) ) { return; + } $term = get_term( $term_id, $taxonomy ); + if ( ! $term || is_wp_error( $term ) ) { + return; + } $args = array( 'action' => 'edit', diff --git a/wp-includes/version.php b/wp-includes/version.php index 33beae18b6..efb7424f47 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32953'; +$wp_version = '4.3-alpha-32954'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.