Support

Account

Home Forums General Issues Get tag title and replace number of posts for tag cloud

Unread

Get tag title and replace number of posts for tag cloud

  • I need to list a cloud of tags but need to replace standard link title with tag title. Tag title is stored as custom field using ACF plugin (field name is ‘title_page’). I’m looking for the way which will not create high load on site. Current so

    $args = array(
    'smallest' => 10,
    'largest' => 10,
    'number' => 250,
    'topic_count_text_callback' => 'my_tag_text_callback',
    ); 
    wp_tag_cloud( $args );  

    Where my_tag_text_callback function is described in functions.php:

    function my_tag_text_callback( $term_id ) {
    $queried_object = get_queried_object();
    $term_id = $queried_object->term_id;  
    $key_title = get_field("title_page", $term_id);
    return $key_title;
    }

    Unfortunately last piece of code does not give any result.

Viewing 1 post (of 1 total)

The topic ‘Get tag title and replace number of posts for tag cloud’ is closed to new replies.