Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Change wording of theme_update_available() warning WordPress

  • SOLVED

I want to change the theme_update_available() function so that the $update_onclick message is my custom wording. Here's the core function... http://wpseek.com/theme_update_available/

The message is confusing to my users

"Updating this theme will lose any customizations you have made"

especially since wp added the Customize feature.

Thanks

Answers (1)

2013-09-24

Dbranes answers:

You might try to use the 'gettext' filter to change it:

add_filter( 'gettext', 'my_gettext', 99, 3 );

function my_gettext( $translated_text, $untranslated_text, $domain ) {

$old_msg = "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.";
$new_msg = "'Cancel' to stop, 'OK' to update.";

if ( is_admin() && $untranslated_text === $old_msg ) {
return $new_msg;
}

return $translated_text;
}


or perphaps translate your own language file.


Joe Calithia comments:

That didn't work.


Dbranes comments:

It works on my install,

did you try the updated version? I had a typo in the function name in the first version.


Dbranes comments:

ps: it might be better to move the <em>is_admin()</em> check outside the function, like this:

is_admin() && add_filter( 'gettext', 'my_gettext', 20, 3 );


so <em>is_admin()</em> will only be called once.


Joe Calithia comments:

Yep, that's it. Didn't notice you had the typo. Thanks