• Nate Zander

    (@mtnporcupine)


    Has anyone had success removing the _links object from the stock GET response?

    I successfully used unset( $_data['field_name'] ); on most of the extraneous fields, but it doesn’t seem to work for _links

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m looking for the same.
    Did you find any solution?

    Unfortunately, you cannot remove it, it’s protected.

    PHP Fatal error:  Uncaught Error: Cannot access protected property WP_REST_Response::$links 
     
    /wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(311)
    	Line 1567: 	$response->add_links( $this->prepare_links( $post ) );
    	Line 1608: 	protected function prepare_links( $post ) {
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove _links object from response’ is closed to new replies.