Skip to content

Snippet: Change the Coma Separator Between Term Lists

Terms (or category) lists are displayed in various parts of the theme such as the Post Meta element as well as theme cards via the wpex_get_post_terms_list() theme function. By default the theme will separate multiple terms using a coma. You can alter the separator globally using the "wpex_list_post_terms_sep" filter as shown below. You can pass on a simple string or HTML.

/**
 * Change term list separator.
 *
 * @link https://total.wpexplorer.com/docs/snippets/post-terms-list-separator/
 */
add_filter( 'wpex_list_post_terms_sep', function( $sep ) {
    $sep = ' | ';
    return $sep;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top