wp() WordPress Function

The wp() function is used to retrieve data from the WordPress database. It can be used to retrieve posts, pages, comments, users, and more. The function can be used in conjunction with the get_*() functions to more narrowly retrieve data.

wp( string|array $query_vars = '' ) #

Set up the WordPress query.


Parameters

$query_vars

(string|array)(Optional)Default WP_Query arguments.

Default value: ''


Top ↑

Source

File: wp-includes/functions.php

function wp( $query_vars = '' ) {
	global $wp, $wp_query, $wp_the_query;

	$wp->main( $query_vars );

	if ( ! isset( $wp_the_query ) ) {
		$wp_the_query = $wp_query;
	}
}


Top ↑

Changelog

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

Show More
Show More