Skip to content

Instantly share code, notes, and snippets.

@gregrickaby
Created August 4, 2014 21:07
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 gregrickaby/738cad75dfc4def693d1 to your computer and use it in GitHub Desktop.
Save gregrickaby/738cad75dfc4def693d1 to your computer and use it in GitHub Desktop.
Auto check the "Open link in a new window/tab" checkbox in WordPress
<?php
// DO NOT INCLUDE THE OPENING PHP TAG AND INSERT INTO FUNCTIONS.PHP
add_action( 'admin_footer', 'custom_new_link_auto_check', 9999 );
/**
* Auto check the "Open link in a new window/tab" modal
*/
function custom_new_link_auto_check() { ?>
<script type="text/javascript">
jQuery ( function($) {
$('input#link-target-checkbox').prop('checked', true);
} );
</script>
<?php }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment