1

I want to change the word "Tags" in Wordpress to something else, i.e. Related Posts, Locations, etc - I've searched all over and I just cannot find it, can any one help??

3 Answers 3

1

The other answers here talk about changing how the translation works, which is a bad practice if there are instances of the word "tag" that you actually want to still be tag. What you likely want is to change the labels of the "tag" taxonomy.

function wpse301755_change_tags_labels( $args, $taxonomy ) {
    if ( 'post_tag' === $taxonomy ) {
        $args['labels'] = array(
            'name'          => 'Locations',
            'singular_name' => 'Location',
            'menu_name'     => 'Locations',
        );
    }
    return $args;
}
add_filter( 'register_taxonomy_args', 'wpse301755_change_tags_labels', 10, 2 );

That changes the labels of the taxonomy without changing how the word "tag" is translated.

There are more labels you can customise which you can see here: https://developer.wordpress.org/reference/functions/get_taxonomy_labels/

Depending on your use case, it may even be better to register a whole new taxonomy: https://developer.wordpress.org/reference/functions/register_taxonomy/

0

Provided that your theme and plugins are properly coded to be translatable you can hook in to WordPress’ gettext filter to replace whatever words you want, like this:

function ma_wp_text_convert( $translated_text, $text, $domain ) {
    if ( ! is_admin() ) :
        switch ( $translated_text ) :
            case 'Tag' :
                $translated_text = __( 'Theme', 'mytextdomain' );
                break;
        endswitch; 
    endif; 
    return $translated_text;
}
add_filter( 'gettext', 'ma_wp_text_convert', 20, 3 );

Note that the text you're searching for must match exactly the text given in the theme/plugin/core code, so you will need to do some digging to ensure that you're getting it right.

For example, in the code above the translated text will only match 'Tag' and not 'Tags', so you will need to add another line:

            case 'Tags' :
                $translated_text = __( 'Themes', 'mytextdomain' );
                break;

Likewise, it won't match the word Tag in Showing All Tags, so you'd need to add one for that too.

-1

My suggestion is, You should try creating custom post types instead changing WP Core functionality.

If you want to change default words of WordPress you should try translation method, please view these two links:

  1. https://www.ait-themes.club/knowledge-base/how-to-change-fixed-words-in-theme/

  2. https://aristath.github.io/blog/howto-change-plugin-theme-text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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