post_unstuck action

Fires once a post has been removed from the sticky list.

do_action( 'post_unstuck', int $post_id )

Description

This is action hook , its fires once a post has been removed from the sticky list.
By using this hook , post can be removed from sticky list.
Its consists of one parameter, that is $post->ID.

Parameters

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

Live Example

To run the hook, copy the example below.

// run the action 
do_action( 'post_unstuck', $post_id ); 
  

The following example is for adding a hook callback.

// define the post_types_to_delete_with_user callback 
function filter_post_types_to_delete_with_user( $post_types_to_delete, $id ) { 
    // make filter magic happen here... 
    return $post_types_to_delete; 
}; 
         
// add the filter 
add_filter( 'post_types_to_delete_with_user', 'filter_post_types_to_delete_with_user', 10, 2 ); 

To remove a hook callback, use the example below.

// remove the action 
remove_action( 'post_unstuck', 'action_post_unstuck', 10, 1 ); 
JOIN 100,000+ SUBSCRIBER's FAMILY

 Subscribe to our weekly newsletter below and never miss the latest updates in WordPress