WP_REST_Request::set_default_params() WordPress Method

The WP_REST_Request::set_default_params() method sets the default parameters for the request. This is useful for setting the default values for the request parameters, such as the 'posts_per_page' or 'orderby' parameters.

WP_REST_Request::set_default_params( array $params ) #

Sets default parameters.


Description

These are the parameters set in the route registration.


Top ↑

Parameters

$params

(array)(Required)Parameter map of key to value.


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-request.php

	public function set_default_params( $params ) {
		$this->params['defaults'] = $params;
	}

Top ↑

Changelog

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