Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use post_submitbox_minor_actions action in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
May 1, 2023
5 minutes read

“`html

post_submitbox_minor_actions action

This action hook fires after the Save Draft (or Save as Pending) and Preview (or Preview Changes) buttons in the Publish meta box. It’s a handy way to run custom functionality at a very specific point in the WordPress post editing process.

The hook consists of one parameter, $post, which refers to the current post object.

  • $post: (WP_Post) WP_Post object for the current post.

Example 1: Running the Hook

To run the hook, simply use the following code snippet. It’s very straightforward!

    // run the action 
    do_action('weplugins_post_submitbox_minor_actions', $post); 
    

Example 2: Adding a Hook Callback

If you need to add a custom function to this hook, use the example below. This way, you can make your custom magic happen right at the right moment.

    // define the weplugins_post_submitbox_minor_actions callback 
    function weplugins_action_post_submitbox_minor_actions($post) { 
        // make action magic happen here... 
    }; 
             
    // add the action 
    add_action('weplugins_post_submitbox_minor_actions', 'weplugins_action_post_submitbox_minor_actions', 10, 1); 
    

Example 3: Removing a Hook Callback

Sometimes, you might want to remove a callback from this hook. Here’s how you can do that. It’s as simple as it gets!

    // remove the action 
    remove_action('weplugins_post_submitbox_minor_actions', 'weplugins_action_post_submitbox_minor_actions', 10, 1); 
    

Access Premium WordPress Plugins

Contact Us

Need customization or have any questions? Feel free to contact us.

“`

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.