Change content of WordPress Editor Buttons

Not every user likes the default settings how some buttons are displayed on the WordPress editor. As of right now, there is no possibility to adjust it directly via a filter. The following source code describes a solution to change the link buttons and their content to easily set links with custom values. The small Plugin changes the values with the help of Javascript and returns a popup for set links with custom values inside the Plugin.


The following source change the strings and you see the result on the screenshot below.

<?php
/**
 * Plugin Name: Change Button Content
 * Version:     0.0.1
 * Plugin URI:  http://bueltge.de/?p=1431
 * Description: Change Link button
 * Author:      Frank Bültge
 * Author URI:  http://bueltge.de/
 */

add_action( 'admin_footer-post.php',     'fb_admin_footer', 9999 );
add_action( 'admin_footer-post-new.php', 'fb_admin_footer', 9999 );
function fb_admin_footer() {
	?>
<script type="text/javascript">
	( function( $ ) {
		
		if ( typeof wpLink == 'undefined' )
			return;
		
		wpLink.setDefaultValues = function () { 
			$('#url-field').val( '<?php echo home_url( '/' ) ?>' );
			$('#link-title-field').val( 'This works :)' );
			$('#wp-link-submit').val( 'Use this link' );
		};
	} )( jQuery );
</script>
	<?php
}

Posted

in

by

Comments

2 responses to “Change content of WordPress Editor Buttons”

  1. Dave Clements Avatar

    This is extremely useful, especially for custom-built sites. How would you go about changing the Publish button to something like Create or Save. This is something I’m trying to do on a current project

  2. Deniel Avatar

    This is really great source of information. Really a great blogger you are. Your post have packed with good information that can be use. Thank you so much for sharing this post.