Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Set up a custom REST API controller class for the Page post type.
- *
- * @author Kellen Mace
- *
- * @param array $args The post type arguments.
- * @param string $name The name of the post type.
- *
- * @return array $args The post type arguments, possibly modified.
- */
- function km_set_custom_page_rest_controller( $args, $name ) {
- // If this post type's name is not 'page', do not modify its args.
- if ( 'page' !== $name ) {
- return $args;
- }
- // Tell WordPress to use our KM_REST_Pages_Controller class
- // for Page REST API requests.
- $args['rest_controller_class'] = 'KM_REST_Pages_Controller';
- return $args;
- }
- add_filter( 'register_post_type_args', 'km_set_custom_page_rest_controller', 10, 2 );
Add Comment
Please, Sign In to add comment