Site logo

Archived topic

How to display only one tag instead of all ?

3 replies · Started by Francesco on June 15, 2020

Viewing posts 1–4 of 4

Hi, is there a way to have the script displays only the first tag and not the entire tags used in a post?

thanks!

Hi there,

try this PHP snippet:

add_filter('term_links-post_tag', function($terms) {
    return array_slice($terms,0,1,true);
} );

Thanks, where should I add this ? function.php file ?

This archived topic is closed to new replies.