Action hook 'posts_selection'

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

View Source

posts_selection

Action Hook
Description
Fires to announce the query's current selection parameters. For use by caching plugins.

Hook Information

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

Hook Parameters

Type Name Description
string $selection The assembled selection query.

Usage Examples

Basic Usage
<?php
// Hook into posts_selection
add_action('posts_selection', 'my_custom_function', 10, 1);

function my_custom_function($selection) {
    // Your custom code here
}

Source Code Context

wp-includes/class-wp-query.php:3037 - How this hook is used in WordPress core
<?php
3032  		 *
3033  		 * @since 2.3.0
3034  		 *
3035  		 * @param string $selection The assembled selection query.
3036  		 */
3037  		do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
3038  
3039  		/*
3040  		 * Filters again for the benefit of caching plugins.
3041  		 * Regular plugins should use the hooks above.
3042  		 */

PHP Documentation

<?php
/**
		 * Fires to announce the query's current selection parameters.
		 *
		 * For use by caching plugins.
		 *
		 * @since 2.3.0
		 *
		 * @param string $selection The assembled selection query.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/class-wp-query.php
Related Hooks

Related hooks will be displayed here in future updates.