On this page
WP_Query::set_404()
Sets the 404 property and saves whether query is feed.
Source
File: wp-includes/class-wp-query.php. View all references
public function set_404() {
$is_feed = $this->is_feed;
$this->init_query_flags();
$this->is_404 = true;
$this->is_feed = $is_feed;
/**
* Fires after a 404 is triggered.
*
* @since 5.5.0
*
* @param WP_Query $query The WP_Query instance (passed by reference).
*/
do_action_ref_array( 'set_404', array( $this ) );
}
Hooks
- do_action_ref_array( 'set_404',
WP_Query $query ) -
Fires after a 404 is triggered.
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::init_query_flags() wp-includes/class-wp-query.php | Resets query flags to false. |
| do_action_ref_array() wp-includes/plugin.php | Calls the callback functions that have been added to an action hook, specifying arguments in an array. |
Used By
| Used By | Description |
|---|---|
| WP_Sitemaps::render_sitemaps() wp-includes/sitemaps/class-wp-sitemaps.php | Renders sitemap templates based on rewrite rules. |
| WP::handle_404() wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| WP_Query::parse_query() wp-includes/class-wp-query.php | Parse a query string and set query type booleans. |
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/set_404