get_{$adjacent}_post_where

FILTER wp-includes\link-template.php (ligne 1991) github
Filters the WHERE 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_where`  - `get_previous_post_where`

Paramètres

Entrée :
$where_prepared, $in_same_term, $excluded_terms, $taxonomy, $post
Sortie :
@param string       $where          The `WHERE` clause in the SQL.
@param bool         $in_same_term   Whether post should be in the same taxonomy term.
@param int[]|string $excluded_terms Array of excluded term IDs. Empty string if none were provided.
@param string       $taxonomy       Taxonomy. Used to identify the term used when `$in_same_term` is true.
@param WP_Post      $post           WP_Post object.

Utilisation

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

function ma_fonction_filtre($where_prepared) {
    // Modifier la valeur
    return $where_prepared;
}

Actualités

Chargement des actualités...