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

How to use post_locked_dialog action in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
October 3, 2022
5 minutes read

Access Premium WordPress Plugins

post_locked_dialog action

This hook fires inside the post locked dialog before the buttons are displayed. It can be quite useful when you need to perform some actions before the post lock dialog is shown to the user.

Description

This action hook fires inside the post locked dialog before the buttons are displayed. It consists of two parameters: the first is $post, which contains the post object to be used, and the second is $user, which contains the user object to be used. It’s used by the _admin_notice_post_locked() hook, which outputs the HTML.

Parameters

  • $post: (WP_Post) Post object.
  • $user: (WP_User) The user with the lock for the post.

Live Examples

Running the Action

To run the hook, copy the example below.

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

Adding a Hook Callback

The following example is for adding a hook callback.

// define the post_locked_dialog callback 
function weplugins_action_post_lock_lost_dialog( $post, $user) { 
    // make action magic happen here... 
}; 
         
// add the action 
add_action( 'weplugins_post_locked_dialog', 'weplugins_action_post_lock_lost_dialog', 10, 2 ); 

Removing a Hook Callback

To remove a hook callback, use the example below.

// remove the action 
remove_action( 'weplugins_post_locked_dialog', 'weplugins_action_post_lock_lost_dialog', 10, 2 );

Contact Us

Need customization or have any questions? 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.