Deseja alterar o texto “Set featured image” (Definir imagem em destaque) no painel de administração do WordPress? Este snippet alterará o texto “Set featured image” (Definir imagem em destaque) para “Set default image” (Definir imagem padrão) ou qualquer texto que você desejar.
Instruções:
Tudo o que você precisa fazer é adicionar esse código ao arquivo functions.php do seu tema ou em um plugin específico do site. Opcionalmente, edite o texto de substituição na linha 2.
function custom_admin_post_thumbnail_html( $content ) { return $content = str_replace( __( 'Set featured image' ), __( 'Set default image' ), $content); } add_filter( 'admin_post_thumbnail_html', 'custom_admin_post_thumbnail_html' );
Observação: Se esta é a primeira vez que você adiciona trechos de código no WordPress, consulte nosso guia sobre como copiar/colar corretamente trechos de código no WordPress, para não danificar seu site acidentalmente.
Se você gostou desse snippet de código, considere dar uma olhada em nossos outros artigos no site, como: 6 melhores plug-ins de otimização de imagens para WordPress (comparados)
Any idea how to do this for the Gutenberg?
Does not work with Gutenberg
Yes, this is for the classic editor. Editing the text in the new Block editor requires different code.
i love wordpress from the bottom of my heart I love it.
How to added meta labels to featured images in wordpress using custom type
?
How could I change the “Featured Image” title of the metabox?
Hey, any idea on how you could limit this to particular custom post types such as “Events” and “Locations” while leaving the default text for standard wordpress pages and posts?
if ($_GET[‘post_type’] == ‘Events’ || $_GET[‘post_type’] == ‘Locations’) {
#your code….
}
great site
[…] from WPSnipp.com – more Featured Image […]
Nice site. I’ve a little problem. When i click on the Set Featured Image it shows the media library and here there are three options saying “Insert into Post” , “set as featured imaged” and “Cancel” which is very confusing I dont want “Insert into Post” appear here. Any ideas, how i can remove insert into post also i dont want Alignment row.
[…] Renamed “Set featured image” to “Set featured image (315w x 190h)” using WPSnipp’s function. […]
Almost exactly what I want. Great site! Your solution works until a featured image is set. Then it gets replaced with “Remove featured image”. I’m sure you could replace that text too, but I want the metabox’s heading to be “Featured Image (315w x 190h)” instead of “Featured Image”. Thanks.
Hi Cliff sorry about the delay did not see your comment, anyway you could do something like this.
add_filter( ‘gettext’, ‘change_featuredimage_txt’ );
add_filter( ‘ngettext’, ‘change_featuredimage_txt’ );
function change_featuredimage_txt( $translated ) {
$translated = str_ireplace( ‘Featured Image’, ‘Slideshow Image’, $translated );
return $translated;
}
Turns out you only need the 2nd one:
// 1function custom_admin_post_thumbnail_html( $content ) { return $content = str_replace( __( ‘Set featured image’ ), __( ‘Set featured image (315w x 190h)’ ), $content);}add_filter( ‘admin_post_thumbnail_html’, ‘custom_admin_post_thumbnail_html’ );
// 2add_filter( ‘gettext’, ‘change_featuredimage_txt’ );add_filter( ‘ngettext’, ‘change_featuredimage_txt’ );function change_featuredimage_txt( $translated ) { $translated = str_ireplace( ‘Featured Image’, ‘Featured image (315w x 190h)’, $translated ); return $translated;}
By having both of those codes in functions.php, the header says “Featured image (315w x 190h)” (which is what I want), but then the link to set the image reads “Set Featured image (315w x 190h) (315w x 190h)”. So I took out the 1st code and just have the 2nd and it works just like I wanted.
The header reads the same as before, but the link text reads “Set Featured image (315w x 190h)”.
Thanks! 🙂
Cool glad you got everything working.
Fantastic little bit of code that one!! Everything I needed and nothing more. Thanks for posting it.
Thanks for posting very helpful
Thank you very much! I find WordPress lacks in a nice overview of where you can find everything. This site’s a great example!
Hi Davey, Glad I could help and enjoy the rest of the site.
Great site
Thanks glad you like the website,