rest_{$this->post_type}_collection_params

FILTER wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php (ligne 3120) github
Filters collection parameters for the posts controller. The dynamic part of the filter `$this->post_type` refers to the post type slug for the controller. This filter registers the collection parameter, but does not map the collection parameter to an internal WP_Query parameter. Use the `rest_{$this->post_type}_query` filter to set WP_Query parameters. @since 4.7.0 @param array        $query_params JSON Schema-formatted collection parameters. @param WP_Post_Type $post_type    Post type object.

Paramètres

Entrée :
$query_params, $post_type
Sortie :
@param array        $query_params JSON Schema-formatted collection parameters.
@param WP_Post_Type $post_type    Post type object.

Utilisation

// Modifier la valeur avec le filtre 'rest_{$this->post_type}_collection_params'
add_filter('rest_{$this->post_type}_collection_params', 'ma_fonction_filtre', 10, 1);

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

Actualités

Chargement des actualités...