rest_route_for_post WordPress Filter Hook

The rest_route_for_post hook is used to add custom routes for posts in the WordPress REST API. This hook allows you to add new routes for your posts, or modify existing routes. You can use this hook to add fields to the response object, or modify the data that is returned for a post.

apply_filters( 'rest_route_for_post', string $route, WP_Post $post ) #

Filters the REST API route for a post.


Parameters

$route

(string)The route path.

$post

(WP_Post)The post object.


Top ↑

Source

File: wp-includes/rest-api.php

View on Trac



Top ↑

Changelog

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