posts_search_orderby WordPress Filter Hook

The posts_search_orderby hook is used to alter the search SQL ORDER BY clause for the search results. This hook can be used to sort search results by relevance, date, title, or any other custom field.

apply_filters( 'posts_search_orderby', string $search_orderby, WP_Query $query ) #

Filters the ORDER BY used when ordering search results.


Parameters

$search_orderby

(string)The ORDER BY clause.

$query

(WP_Query)The current WP_Query instance.


Top ↑

Source

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

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
3.7.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