posts_selection WordPress Action Hook

The posts_selection hook is used to modify the SQL query that is used to fetch posts from the database. This hook is used to modify the query based on various conditions.

do_action( 'posts_selection', string $selection ) #

Fires to announce the query’s current selection parameters.


Description

For use by caching plugins.


Top ↑

Parameters

$selection

(string)The assembled selection query.


Top ↑

More Information

This action hook is executed prior to the query and is passed a string containing the assembled query. Note that this string is NOT passed by reference and manipulating this string will not affect the actual query. This is intended to be used primarily by caching plugins.


Top ↑

Source

File: wp-includes/class-wp-query.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More