unstick_post( int $post_id )
Un-stick a post.
Description Description
Sticky posts should be displayed at the top of the front page.
Parameters Parameters
- $post_id
-
(int) (Required) Post ID.
Source Source
File: wp-includes/post.php
2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 | function unstick_post( $post_id ) { $stickies = get_option( 'sticky_posts' ); if ( ! is_array ( $stickies ) ) { return ; } if ( ! in_array( $post_id , $stickies ) ) { return ; } $offset = array_search ( $post_id , $stickies ); if ( false === $offset ) { return ; } array_splice ( $stickies , $offset , 1 ); $updated = update_option( 'sticky_posts' , $stickies ); if ( $updated ) { /** * Fires once a post has been removed from the sticky list. * * @since 4.6.0 * * @param int $post_id ID of the post that was unstuck. */ do_action( 'post_unstuck' , $post_id ); } } |
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
2.7.0 | Introduced. |