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.
$query_params, $post_type
Sortie :
@param array $query_params JSON Schema-formatted collection parameters. @param WP_Post_Type $post_type Post type object.
// 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;
}
Chargement des actualités...