custom taxonomy - Separate tags with semicolon

admin2025-06-05  1

Does anyone know if there is a way to change the callback function for a tag-like custom taxonomy so that it breaks terms after a semicolon instead of a comma? I realize I can rewrite the whole meta box, but I'd rather not if there's an easier way.

Does anyone know if there is a way to change the callback function for a tag-like custom taxonomy so that it breaks terms after a semicolon instead of a comma? I realize I can rewrite the whole meta box, but I'd rather not if there's an easier way.

Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Mar 15, 2013 at 20:07 gboonegboone 132 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 3

The tag delimiter is made translatable:

$comma = _x( ',', 'tag delimiter' );

So this can be changed with a simple filter:

add_filter( 'gettext_with_context', 't5_semicolon_tag_delimiter', 10, 4 );

function t5_semicolon_tag_delimiter( $translated, $text, $context, $domain )
{
    if ( 'default' !== $domain or 'tag delimiter' !== $context or ',' !== $text )
        return $translated;

    return ';';
}

Install as plugin; works without any side effects.

What is tricky: changing the string Separate tags with commas to say semicolon. You cannot use the same solution, because you don’t know the language of your users. Not sure how to handle that.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749132382a316635.html

最新回复(0)