Someone asked about this in the forums. I can see why folks would find it useful, so here’s a simple addition to add a ‘Cancel Post’ button to your publishing metabox.

This plugin checks what post-type you’re on and redirects you correctly for pages and CPTs.

To Install

Make a file called cancel-button.php and put it in your mu-plugins folder (if you don’t have one, just make it in /wp-content/). In that file, paste the following (yes there’s no ending PHP tag, it’s okay, you don’t need it):


Plugin Name: Cancel
Plugin URI:
Description: Adds a 'cancel' button to posts, next to Publish.
Version: 1.0
Author: Ipstenu
License: GPL2


add_action( 'post_submitbox_misc_actions', 'author_in_publish' );

function author_in_publish() {
    $screen = get_current_screen();
    $cancel = get_admin_url();
    if ( $screen->id == 'post') {$cancel = "edit.php"; }
    else { $cancel = "edit.php?post_type=$screen->id";}
    echo "<div class=\"misc-pub-section\"><a class=\"button\" href=\"".$cancel."\" id=\"post-preview\">".__('Cancel Post')."</a><input type=\"hidden\" name=\"wp-cancelpost\" id=\"wp-cancelpost\" value=\"\"></div>";

This will add the button for all your sites on a network, if you happen to use Multisite.

Reader Interactions


  1. This is fantastic. While I don’t have a use for this button per se, you’ve just shown me how to hook into the submitbox via example. Thanks! Been wondering about that, but haven’t had a reason to actually do it, so I hadn’t had call to learn before today. 🙂

  2. Interesting. Occasionally I’ll get a client I’d like to bake another feature in for:

  3. Jack Beauregard says:

    Ah, one stupid question: what does that snippet do?

  4. Jack Beauregard says:

    Yeah, that’s exactly what it does in my case. Thought it would delete the draft or something …

%d bloggers like this: