Docs: Add documentation to get_query_var()
and WP_Query::get()
for the optional $default
argument, introduced in 3.9 in [27304].
Props swissspidy. Fixes #33856. git-svn-id: https://develop.svn.wordpress.org/trunk@34284 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6e6d026524
commit
572e3ddafb
@ -15,12 +15,13 @@
|
||||
* Retrieve variable in the WP_Query class.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 3.9.0 The `$default` argument was introduced.
|
||||
*
|
||||
* @global WP_Query $wp_query
|
||||
*
|
||||
* @param string $var The variable key to retrieve.
|
||||
* @param mixed $default Value to return if the query variable is not set. Default ''.
|
||||
* @return mixed
|
||||
* @param mixed $default Optional. Value to return if the query variable is not set. Default empty.
|
||||
* @return mixed Contents of the query variable.
|
||||
*/
|
||||
function get_query_var( $var, $default = '' ) {
|
||||
global $wp_query;
|
||||
@ -2358,11 +2359,13 @@ class WP_Query {
|
||||
* Retrieve query variable.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 3.9.0 The `$default` argument was introduced.
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @param string $query_var Query variable key.
|
||||
* @param mixed $default Value to return if the query variable is not set. Default ''.
|
||||
* @return mixed
|
||||
* @param mixed $default Optional. Value to return if the query variable is not set. Default empty.
|
||||
* @return mixed Contents of the query variable.
|
||||
*/
|
||||
public function get( $query_var, $default = '' ) {
|
||||
if ( isset( $this->query_vars[ $query_var ] ) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user