Adding another “Add Post” button to admin

I would like another “Add post” button in the admin except I am going to call it “Add voucher”. It will run specific plugins that add post will not. However that is irrelivant, all I need to know it how to add another add post button with the same features.

Related posts

Leave a Reply

1 comment

  1. Unfortunately this isn’t possible (without a slight hack)- since there are no hooks provided (see for example the edit.php page).

    A quick and easy hack is to use JavaScript to add the link after the usual ‘Add New’ link. Here I’ve used the admin_print_footer_scripts hook (on ‘post’, or ‘edit-post’ screens) to print the JavaScript. Note that you must alter this to work for other post types.

    add_action('admin_print_footer_scripts','wpse57033_add_new_voucher_link');
    function wpse57033_add_new_voucher_link(){
        $screen = get_current_screen();
        if( $screen->id == 'edit-post' || $screen->id == 'post' ){
            ?>
                <script>
                jQuery('.wrap h2 .add-new-h2').after('<a href="" class="add-new-h2">Add New Voucher</a>');
                </script>
            <?php
        }
    }