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.


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.

| improve this answer | |
  • This still will not work, because of these two lines in the wp_set_post_terms function: $tags = str_replace( $comma, ',', $tags ); $tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) );. No matter what you do, at some point the underlying WordPress code will force your tags to be delimited by commas. – Jordan Reiter Jul 15 '15 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.