Update Plugin Label in WordPress Backend

Working on client websites with installed plugins, use the below information to update labels in the backend sidebar so the updating information is easier to find.

Events example:

function rename_header_to_logo( $translated, $original, $domain ) {

$strings = array(
'Events' => 'Pool Events',
);

if ( isset( $strings[$original] ) && is_admin() ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}

return $translated;
}

add_filter( 'gettext', 'rename_header_to_logo', 10, 3 );

WooCommerce example:

function rename_header_to_logo( $translated, $original, $domain ) {

$strings = array(
'WooCommerce' => 'Stall',
'Custom Header' => 'Custom Stall'
);

if ( isset( $strings[$original] ) && is_admin() ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}

return $translated;
}

add_filter( 'gettext', 'rename_header_to_logo', 10, 3 );

Source.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.