rest_api_init WordPress Action Hook

This hook is called when the WordPress REST API is first initialized. It allows you to register custom routes and endpoints, and also to modify default behavior if needed.

do_action( 'rest_api_init', WP_REST_Server $wp_rest_server ) #

Fires when preparing to serve a REST API request.


Description

Endpoint objects should be created and register their hooks on this action rather than another action to ensure they’re only loaded when needed.


Top ↑

Parameters

$wp_rest_server

(WP_REST_Server)Server object.


Top ↑

Source

File: wp-includes/rest-api.php

View on Trac



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.

Show More