Filter hook 'is_sticky'

in WP Core File wp-includes/post.php at line 2852

View Source

is_sticky

Filter Hook
Description
Filters whether a post is sticky.

Hook Information

File Location wp-includes/post.php View on GitHub
Hook Type Filter
Line Number 2852

Hook Parameters

Type Name Description
bool $is_sticky Whether a post is sticky.
int $post_id Post ID.

Usage Examples

Basic Usage
<?php
// Hook into is_sticky
add_filter('is_sticky', 'my_custom_filter', 10, 2);

function my_custom_filter($is_sticky, $post_id) {
    // Your custom filtering logic here
    return $is_sticky;
}

Source Code Context

wp-includes/post.php:2852 - How this hook is used in WordPress core
<?php
2847  	 * @since 5.3.0
2848  	 *
2849  	 * @param bool $is_sticky Whether a post is sticky.
2850  	 * @param int  $post_id   Post ID.
2851  	 */
2852  	return apply_filters( 'is_sticky', $is_sticky, $post_id );
2853  }
2854  
2855  /**
2856   * Sanitizes every post field.
2857   *

PHP Documentation

<?php
/**
	 * 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.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/post.php
Related Hooks

Related hooks will be displayed here in future updates.