Replace comma separator from terms list output
Here is a code snippet to replace the comma
character between single post terms:
add_filter( 'generate_term_separator', function() { return '-'; } );
The above code will replace the comma with a -
. You can also remove it altogether by removing the -
in the return
statement.
add_filter( 'generate_term_separator', function() { return ''; } );
Or replace it with a space:
add_filter( 'generate_term_separator', function() { return ' '; } );
Here is how to replace the comma
with a space
inside a WP Show Posts card:
add_filter( 'wpsp_term_separator', function() { return ' '; } );
Finally, here is how to do it if your terms are located inside a header element as a template tag:
add_filter( 'generate_page_hero_terms_separator', function() { return ' '; } );