Skip to content

Instantly share code, notes, and snippets.

@trepmal
Last active March 8, 2016 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trepmal/86c2c2251c12ede80417 to your computer and use it in GitHub Desktop.
Save trepmal/86c2c2251c12ede80417 to your computer and use it in GitHub Desktop.
<?php
// Plugin Name: Example. Change "Excerpt" meta box heading
namespace KDL\excerpt_change;
function filter_excerpt( $translations, $text, $domain ) {
if ( $text == 'Excerpt' ) {
return "New Excerpt";
}
return $translations;
}
// hook in as close as possible, in this case fake an action
add_filter( 'post_updated_messages', function($i) {
add_filter( 'gettext', __NAMESPACE__ . '\\filter_excerpt', 10, 3 );
return $i;
});
// and clean up as soon as possible
add_action( 'dbx_post_advanced', function() {
remove_filter( 'gettext', __NAMESPACE__ . '\\filter_excerpt', 10, 3 );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment