get_{$adjacent}_post_sort

FILTER wp-includes\link-template.php (ligne 2013) github
Filters the ORDER BY clause in the SQL for an adjacent post query. The dynamic portion of the hook name, `$adjacent`, refers to the type of adjacency, 'next' or 'previous'. Possible hook names include:  - `get_next_post_sort`  - `get_previous_post_sort`

Paramètres

Entrée :
"ORDER BY p.post_date $order, p.ID $order LIMIT 1", $post, $order
Sortie :
@param string $order_by The `ORDER BY` clause in the SQL.
@param WP_Post $post    WP_Post object.
@param string  $order   Sort order. 'DESC' for previous post, 'ASC' for next.

Utilisation

// Modifier la valeur avec le filtre 'get_{$adjacent}_post_sort'
add_filter('get_{$adjacent}_post_sort', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre("ORDER BY p.post_date $order) {
    // Modifier la valeur
    return "ORDER BY p.post_date $order;
}

Actualités

Chargement des actualités...