Make WordPress Core

Opened 6 years ago

Last modified 3 years ago

#44802 new defect (bug)

WP Generate Tag cloud not generating Link (href) tag value and Role tag value.

Reported by: tpkahlon's profile tpkahlon Owned by:
Milestone: Awaiting Review Priority: normal
Severity: major Version: 4.9.8
Component: Taxonomy Keywords: reporter-feedback
Focuses: Cc:

Description

See demo: https://www.atsspec.com/blog/.

The tags are generated using wp_generate_tag_cloud function but are not clickable and has "role" tag associated with each hyperlink.

Change History (3)

#1 @SergeyBiryukov
6 years ago

  • Component changed from General to Taxonomy
  • Keywords reporter-feedback added; dev-feedback removed

Hi @tpkahlon, welcome to WordPress Trac! Thanks for the report.

Does it still happen on a clean install with all plugins disabled and a default theme (Twenty Seventeen) activated?

Could you share the code where you're using wp_generate_tag_cloud()?

#2 @tpkahlon
6 years ago

Hello Sergey,

Please use the following snippet provided in following link: https://www.wpbeginner.com/plugins/how-to-display-most-popular-tags-in-wordpress/.

If you paste the snippet inside "functions.php" in Twenty Seventeen theme and include a Text in widget with [wpb_popular_tags].

It will generate a tag cloud with "role" and "href" attribute missing.

#3 @chriscoyier
3 years ago

Just noting the same...

If I do

<?php 

  $tags = get_tags(); 

  $tag_string = wp_generate_tag_cloud($tags, array(
    'smallest'                  => 1.5, 
    'largest'                   => 1.5,
    'unit'                      => 'rem', 
    'number'                    => 0,  
    'format'                    => 'list',
    'orderby'                   => 'count', 
    'order'                     => 'DESC',
    'show_count'                => true,
    'echo'                      => false
  ));

  echo $tag_string;

?>

I get HTML output of a list of tags, but the URL's are all missing, like

<ul class='wp-tag-cloud' role='list'>
<li><a href="" class="tag-cloud-link tag-link-1108 tag-link-position-1" style="font-size: 1.5rem;" aria-label="SVG (188 items)">SVG<span class="tag-link-count"> (188)</span></a></li>
<li><a href="" class="tag-cloud-link tag-link-30 tag-link-position-2" style="font-size: 1.5rem;" aria-label="accessibility (147 items)">accessibility<span class="tag-link-count"> (147)</span></a></li>

Note: See TracTickets for help on using tickets.