Last active
March 8, 2016 19:44
-
-
Save trepmal/86c2c2251c12ede80417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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