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

How to use post_stuck action in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
July 6, 2022
5 minutes read

post_stuck action

Fires once a post has been added to the sticky list.

do_action( 'post_stuck', int $post_id )

Description

This is action hook , whenever its fires after a post has been added to sticky list.
Its consists of one parameter, $post_id ,which is belongs to post thae was stuck.

Parameters

  • $post_id : (int) ID of the post that was stuck.

Live Example

To run the hook, copy the example below.

do_action( 'post_stuck', int $post_id )
  

The following example is for adding a hook callback.

add_action( 'post_stuck', 'wp_post_stuck_action' );

/**
 * Function for `post_stuck` action-hook.
 * 
 * @param int $post_id ID of the post that was stuck.
 *
 * @return void
 */
function wp_post_stuck_action( $post_id ){

	// action...
}

To remove a hook callback, use the example below.

// remove the action
remove_action( 'post_stuck', 'wp_post_stuck_action', 10, 1 ); 
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.