diff --git a/wp-admin/edit-tags.php b/wp-admin/edit-tags.php
index 5a0b35097..f386027a8 100644
--- a/wp-admin/edit-tags.php
+++ b/wp-admin/edit-tags.php
@@ -273,7 +273,7 @@ do_action('edit_tag_form', $tag);
-
+ 'edit')); ?>
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 7033519d8..59c5947cf 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -551,7 +551,7 @@ function wp_tag_cloud( $args = '' ) {
$defaults = array(
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
- 'exclude' => '', 'include' => ''
+ 'exclude' => '', 'include' => '', 'link' => 'view'
);
$args = wp_parse_args( $args, $defaults );
@@ -561,7 +561,10 @@ function wp_tag_cloud( $args = '' ) {
return;
foreach ( $tags as $key => $tag ) {
- $link = get_tag_link( $tag->term_id );
+ if ( 'edit' == $args['link'] )
+ $link = get_edit_tag_link( $tag->term_id );
+ else
+ $link = get_tag_link( $tag->term_id );
if ( is_wp_error( $link ) )
return false;
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 5efe57a83..7794e1932 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -558,6 +558,48 @@ function get_tag_feed_link($tag_id, $feed = '') {
return $link;
}
+/**
+ * Retrieve edit tag link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $tag_id Tag ID
+ * @return string
+ */
+function get_edit_tag_link( $tag_id = 0 ) {
+ $tag = get_term($tag_id, 'post_tag');
+
+ if ( !current_user_can('manage_categories') )
+ return;
+
+ $location = admin_url('edit-tags.php?action=edit&tag_ID=') . $tag->term_id;
+ return apply_filters( 'get_edit_tag_link', $location );
+}
+
+/**
+ * Display or retrieve edit tag link with formatting.
+ *
+ * @since 2.7.0
+ *
+ * @param string $link Optional. Anchor text.
+ * @param string $before Optional. Display before edit link.
+ * @param string $after Optional. Display after edit link.
+ * @param int|object $tag Tag object or ID
+ * @return string|null HTML content, if $echo is set to false.
+ */
+function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
+ $tag = get_term($tag, 'post_tag');
+
+ if ( !current_user_can('manage_categories') )
+ return;
+
+ if ( empty($link) )
+ $link = __('Edit This');
+
+ $link = '' . $link . '';
+ echo $before . apply_filters( 'edit_tag_link', $link, $tag->term_id ) . $after;
+}
+
/**
* Retrieve the permalink for the feed of the search results.
*
@@ -716,10 +758,9 @@ function get_edit_comment_link( $comment_id = 0 ) {
* @param string $link Optional. Anchor text.
* @param string $before Optional. Display before edit link.
* @param string $after Optional. Display after edit link.
- * @param bool $echo Optional, defaults to true. Whether to echo or return HTML.
* @return string|null HTML content, if $echo is set to false.
*/
-function edit_comment_link( $link = 'Edit This', $before = '', $after = '', $echo = true ) {
+function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
global $comment, $post;
if ( $post->post_type == 'attachment' ) {
@@ -732,11 +773,7 @@ function edit_comment_link( $link = 'Edit This', $before = '', $after = '', $ech
}
$link = '' . $link . '';
- $link = $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
- if ( $echo )
- echo $link;
- else
- return $link;
+ echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
}
/**