Solución definitiva – ¿Como renombrar los post format de wordpress?

function rename_post_formats( $safe_text ) {
 if ( $safe_text == 'Cita' )
 return 'Snippet';
 if ( $safe_text == 'Aside' )
 return 'Libro';

return $safe_text;
}
add_filter( 'esc_html', 'rename_post_formats' );

//rename Aside in posts list table
function live_rename_formats() {
 global $current_screen;

if ( $current_screen->id == 'edit-post' ) { ?>
 <script type="text/javascript">
 jQuery('document').ready(function() {

jQuery("span.post-state-format").each(function() {
 if ( jQuery(this).text() == "Cita" )
 jQuery(this).text("Snippet");
 if ( jQuery(this).text() == "Aside" )
 jQuery(this).text("Libro");
 });

});
 </script>
<?php }
}
add_action('admin_head', 'live_rename_formats');

function rename_post_formats_snippet($translation, $text, $context, $domain) {
 $names = array(
 'Quote' => 'Snippets',
 'Aside' => 'Libros'
 );
 if ($context == 'Post format') {
 $translation = str_replace(array_keys($names), array_values($names), $text);
 }
 return $translation;
}
add_filter('gettext_with_context', 'rename_post_formats_snippet', 10, 4);

You may also like...