This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
post_stuck action
Fires once a post has been added to the sticky list.
do_action( 'post_stuck', int $post_id )
Description
This action hook fires whenever a post has been added to the sticky list. It consists of one parameter, $post_id, which belongs to the post that was stuck.
Parameters
- $post_id: (int) ID of the post that was stuck.
Live Examples
Example 1: Running the Hook
To run the hook, you can copy the example below.
do_action( 'post_stuck', int $post_id );
Example 2: Adding a Hook Callback
The following example shows how to add a hook callback.
add_action( 'post_stuck', 'weplugins_post_stuck_action' ); /** * Function for `post_stuck` action-hook. * * @param int $post_id ID of the post that was stuck. * * @return void */ function weplugins_post_stuck_action( $post_id ){ // action... }
Example 3: Removing a Hook Callback
To remove a hook callback, use the example below.
// remove the action remove_action( 'post_stuck', 'weplugins_post_stuck_action', 10, 1 );
Contact Us
If you need any customization or have any questions, feel free to contact us.
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.