Filter hook 'posts_request_ids'

in WP Core File wp-includes/class-wp-query.php at line 3417

View Source

posts_request_ids

Filter Hook
Description
Filters the Post IDs SQL request before sending.

Hook Information

File Location wp-includes/class-wp-query.php View on GitHub
Hook Type Filter
Line Number 3417

Hook Parameters

Type Name Description
string $request The post ID request.
WP_Query $query The WP_Query instance.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-query.php:3417 - How this hook is used in WordPress core
<?php
3412  				 * @since 3.4.0
3413  				 *
3414  				 * @param string   $request The post ID request.
3415  				 * @param WP_Query $query   The WP_Query instance.
3416  				 */
3417  				$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
3418  
3419  				$post_ids = $wpdb->get_col( $this->request );
3420  
3421  				if ( $post_ids ) {
3422  					$this->posts = $post_ids;

PHP Documentation

<?php
/**
				 * Filters the Post IDs SQL request before sending.
				 *
				 * @since 3.4.0
				 *
				 * @param string   $request The post ID request.
				 * @param WP_Query $query   The WP_Query instance.
				 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-query.php
Related Hooks

Related hooks will be displayed here in future updates.