WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#15313 closed enhancement (fixed)

Allow wp_tag_cloud() to accept an array of taxonomies

Reported by: sorich87 Owned by: sorich87
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

Allow wp_tag_cloud() to accept an array of arguments.

Attachments (1)

15313.diff (640 bytes) - added by sorich87 3 years ago.

Download all attachments as: .zip

Change History (11)

sorich873 years ago

comment:1 sorich873 years ago

  • Cc sorich87@… added
  • Keywords has-patch added
  • Owner set to sorich87
  • Status changed from new to accepted
  • Version set to 3.1

Added patch

comment:2 sorich873 years ago

  • Summary changed from Allow wp_tag_cloud() to accept an array of arguments to Allow wp_tag_cloud() to accept an array of taxonomies

comment:3 scribu3 years ago

Your patch makes sense, but it doesn't match with the description.

When is $tag->taxonomy ever an array?

comment:4 sorich873 years ago

It is actually assumed that $args['taxonomy'] is always a string. So, it is passed to get_term_link() which only accept a string as second argument.

When $args['taxonomy'] is not a string but an array, we get an error.

Replacing $args['taxonomy'] by $tag->taxonomy fixes the issue.

comment:5 scribu3 years ago

Could you provide some steps to reproduce the error?

comment:6 scribu3 years ago

  • Keywords reporter-feedback added

comment:7 sorich873 years ago

  • Keywords reporter-feedback removed

The following code will produce the error:

$args = array(
    'taxonomy' => array( 'category', 'post_tag' )
);
wp_tag_cloud( $args );

comment:9 scribu3 years ago

  • Milestone changed from Awaiting Review to 3.1

comment:10 scribu3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [16180]) Allow tag cloud using multiple taxonomies. Props sorich87. Fixes #15313

Note: See TracTickets for help on using tickets.