Popular tags' edit links should respect the current post type. Adds unit test.
Props mordauk, fahmiadib. Fixes #25566. Built from https://develop.svn.wordpress.org/trunk@27720 git-svn-id: http://core.svn.wordpress.org/trunk@27558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d63fbed03d
commit
c38cf4f912
|
@ -370,7 +370,7 @@ do_action( "after-{$taxonomy}-table", $taxonomy );
|
||||||
|
|
||||||
if ( !is_null( $tax->labels->popular_items ) ) {
|
if ( !is_null( $tax->labels->popular_items ) ) {
|
||||||
if ( current_user_can( $tax->cap->edit_terms ) )
|
if ( current_user_can( $tax->cap->edit_terms ) )
|
||||||
$tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false, 'link' => 'edit' ) );
|
$tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) );
|
||||||
else
|
else
|
||||||
$tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) );
|
$tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) );
|
||||||
|
|
||||||
|
|
|
@ -571,6 +571,9 @@ function wp_list_categories( $args = '' ) {
|
||||||
* The 'topic_count_text_callback' argument is a function, which given the count
|
* The 'topic_count_text_callback' argument is a function, which given the count
|
||||||
* of the posts with that tag returns a text for the tooltip of the tag link.
|
* of the posts with that tag returns a text for the tooltip of the tag link.
|
||||||
*
|
*
|
||||||
|
* The 'post_type' argument is used only when 'link' is set to 'edit'. It determines the post_type
|
||||||
|
* passed to edit.php for the popular tags edit links.
|
||||||
|
*
|
||||||
* The 'exclude' and 'include' arguments are used for the {@link get_tags()}
|
* The 'exclude' and 'include' arguments are used for the {@link get_tags()}
|
||||||
* function. Only one should be used, because only one will be used and the
|
* function. Only one should be used, because only one will be used and the
|
||||||
* other ignored, if they are both set.
|
* other ignored, if they are both set.
|
||||||
|
@ -584,7 +587,7 @@ function wp_tag_cloud( $args = '' ) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
|
'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
|
||||||
'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
|
'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
|
||||||
'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
|
'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true
|
||||||
);
|
);
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
|
|
||||||
|
@ -595,7 +598,7 @@ function wp_tag_cloud( $args = '' ) {
|
||||||
|
|
||||||
foreach ( $tags as $key => $tag ) {
|
foreach ( $tags as $key => $tag ) {
|
||||||
if ( 'edit' == $args['link'] )
|
if ( 'edit' == $args['link'] )
|
||||||
$link = get_edit_tag_link( $tag->term_id, $tag->taxonomy );
|
$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
|
||||||
else
|
else
|
||||||
$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
|
$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
|
||||||
if ( is_wp_error( $link ) )
|
if ( is_wp_error( $link ) )
|
||||||
|
|
Loading…
Reference in New Issue