Sticky posts should remain at the top of The Loop. If the post ID is not given, then The Loop ID for the current post will be used. For more information on this and similar theme functions, check out the <a href="https://developer.wordpress.org/themes/basics/conditional-tags/">https://developer.wordpress.org/themes/basics/conditional-tags/</a> Conditional Tags article in the Theme Developer Handbook.
Parameters
$post_idintoptional
Post ID. Default is the ID of the global $post.Default: 0
Return
bool
Whether post is sticky.
Hooks fired · 1
One hook fires while is_sticky() runs, in this order:
2875functionis_sticky($post_id=0){2876$post_id=absint($post_id);28772878if(!$post_id){2879$post_id=get_the_ID();2880}28812882$stickies=get_option('sticky_posts');28832884if(is_array($stickies)){2885$stickies=array_map('intval',$stickies);2886$is_sticky=in_array($post_id,$stickies,true);2887}else{2888$is_sticky=false;2889}28902891/**2892 * Filters whether a post is sticky.2893 *2894 * @since 5.3.02895 *2896 * @param bool $is_sticky Whether a post is sticky.2897 * @param int $post_id Post ID.2898 */2899returnapply_filters('is_sticky',$is_sticky,$post_id);2900}
History
Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/post.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.