| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 898 lines (29 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
WP:: (12 methods):
add_query_var()
remove_query_var()
set_query_var()
parse_request()
send_headers()
build_query_string()
register_globals()
init()
query_posts()
handle_random()
handle_404()
main()
| add_query_var( $qv ) X-Ref |
| Adds a query variable to the list of public query variables. param: string $qv Query variable name. |
| remove_query_var( $name ) X-Ref |
| Removes a query variable from a list of public query variables. param: string $name Query variable name. |
| set_query_var( $key, $value ) X-Ref |
| Sets the value of a query variable. param: string $key Query variable name. param: mixed $value Query variable value. |
| parse_request( $extra_query_vars = '' ) X-Ref |
| Parses the request to find the correct WordPress query. Sets up the query variables based on the request. There are also many filters and actions that can be used to further manipulate the result. return: bool Whether the request was parsed. param: array|string $extra_query_vars Set the extra query variables. |
| send_headers() X-Ref |
| Sends additional HTTP headers for caching, content type, etc. Sets the Content-Type header. Sets the 'error' status (if passed) and optionally exits. If showing a feed, it will also send Last-Modified, ETag, and 304 status if needed. |
| build_query_string() X-Ref |
| Sets the query string property based off of the query variable property. The {@see 'query_string'} filter is deprecated, but still works. Plugins should use the {@see 'request'} filter instead. |
| register_globals() X-Ref |
| Set up the WordPress Globals. The query_vars property will be extracted to the GLOBALS. So care should be taken when naming global variables that might interfere with the WordPress environment. |
| init() X-Ref |
| Set up the current user. |
| query_posts() X-Ref |
| Set up the Loop based on the query variables. |
| handle_random() X-Ref |
| Redirects random content requests to a randomly selected post. For random content requests, runs the main query to select a single random post from the requested archive and redirects to it. For example, `example.com/random/` redirects to a random post and `example.com/random/category/news/` redirects to a random post in the "news" category. The random post is selected by the main query, so {@see 'pre_get_posts'} callbacks customizing the archive apply to the selection. While the query runs, callbacks enforcing the eligible posts, order and limit are added after any other callbacks: - {@see wp_random_content_pre_get_posts()} on the {@see 'pre_get_posts'} action. - {@see wp_random_content_posts_orderby()} on the {@see 'posts_orderby'} filter. - {@see wp_random_content_post_limits()} on the {@see 'post_limits'} filter. If no post is selected, for example on an empty archive, the request is a 404 as there is no post to redirect to. If a post is selected but the request is not redirected, the request continues with the results of the main query. The main query is not run again. return: bool Whether the main query was run for a random content request. |
| handle_404() X-Ref |
| Set the Headers for 404, if nothing is found for requested URL. Issue a 404 if a request doesn't match any posts and doesn't match any object (e.g. an existing-but-empty category, tag, author) and a 404 was not already issued, and if the request was not a search or the homepage. Otherwise, issue a 200. This sets headers after posts have been queried. handle_404() really means "handle status". By inspecting the result of querying posts, seemingly successful requests can be switched to a 404 so that canonical redirection logic can kick in. |
| main( $query_args = '' ) X-Ref |
| Sets up all of the variables required by the WordPress environment. The action {@see 'wp'} has one parameter that references the WP object. It allows for accessing the properties and methods to further manipulate the object. param: string|array $query_args Passed to parse_request(). |
| Generated : Mon Nov 2 08:20:36 2026 | Cross-referenced by PHPXref |