GeneratePress: Remove Comma between tags

Srivishnu Ramakrishnan
Srivishnu Ramakrishnan
Engineer & Web Creator
LinkedInTwitter

In GeneratePress, tags are separated by 'comma' when they are displayed on the front end of the website. In some cases, that may not be what you are after.

Here's a simple code to remove 'comma' between tags on GeneratePress:

php
add_filter( 'generate_tag_list_output', function( $output ) {
    $tags_list = get_the_tag_list( '', '' );
 
    return sprintf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', // WPCS: XSS ok, sanitization ok.
        esc_html_x( 'Tags', 'Used before tag names.', 'generatepress' ),
        $tags_list
    );
} );

How to add this code to your WordPress site

How to Add PHP Code to WordPress