How can I add a sub menu link using add_submenu_page that will open a new window (target="_blank") instead of opening in the current one (default behavior)?

  • A good question :) Any help on this?
    – Diosney
    Commented Sep 23, 2012 at 20:35

1 Answer 1


This has to be solved:

  • with an unconventional submenu manipulation, provided by @t31os in this Answer
  • and some jQuery
add_action( 'admin_menu', 'wpse_66020_admin_menu_new_item' );
add_action( 'admin_head', 'wpse_66020_add_jquery' );

function wpse_66020_admin_menu_new_item() 
    global $submenu;
    $submenu['index.php'][500] = array( 
                                    '<div id="wpse-66020">Go to WPSE</div>'
                                ,   'manage_options' 
                                ,   'https://wordpress.stackexchange.com/' 

function wpse_66020_add_jquery() 
    <script type="text/javascript">
        jQuery(document).ready( function($) {   

Resulting in this:

submenu with _blank target
click to enlarge


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.