WordPress at a glance

is_sticky() WP 1.0

Check if post is sticky.

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 Conditional Tags article in the Theme Developer Handbook.

Hooks from the function

true/false. Whether post is sticky.


is_sticky( $post_id );
Post ID.
Default: ID of the global $post


Since 2.7.0 Introduced.

Code of is sticky: wp-includes/post.php WP 5.4.2

function is_sticky( $post_id = 0 ) {
	$post_id = absint( $post_id );

	if ( ! $post_id ) {
		$post_id = get_the_ID();

	$stickies = get_option( 'sticky_posts' );

	$is_sticky = is_array( $stickies ) && in_array( $post_id, $stickies );

	 * Filters whether a post is sticky.
	 * @since 5.3.0
	 * @param bool $is_sticky Whether a post is sticky.
	 * @param int  $post_id   Post ID.
	return apply_filters( 'is_sticky', $is_sticky, $post_id );

Related Functions

From tag: Conditional tags (all)

More from category: Other

More from Template Tags: Main Functions

No comments
        Log In . Register