WordPress Content Editor Default Links To New Tab/Window
WordPress Content Editor Default Links To New Tab/Window
When writing a new blog post or creating a new page, you’ll often use the Link icon to embed new links into the content editor. Most know that they can force the link to open in a new tab/window by ticking the checkbox when creating the link.
While the process is easy, it is an extra click. Extra clicks equate to more human error. I’ve had clients ask for this checkbox to be defaulted. It’s a pretty quick little function that can be added to your themes functions.php file:
function default_blank_wp_tiny_mce() { ?> <script type="text/javascript"> jQuery( function() { jQuery( 'input#wp-link-target' ).prop( 'checked', true ); } ); </script> <?php } add_action( 'after_wp_tiny_mce', 'default_blank_wp_tiny_mce' );
Share Your Thoughts