WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/08/2018 06:18:25 PM (3 years ago)
Author:
danielbachhuber
Message:

REST API: Persist attributes for attachment links

In [43437], the link definition implementation caused attachment links to be unexpectedly nested under an attributes key. This changeset restores the prior behavior.

Props TimothyBlynJacobs.
Fixes #44750.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r43530 r43681  
    373373        // Wrap the data in a response object.
    374374        $response = rest_ensure_response( $data );
    375         $response->add_links( $links );
     375
     376        foreach ( $links as $rel => $rel_links ) {
     377            foreach ( $rel_links as $link ) {
     378                $response->add_link( $rel, $link['href'], $link['attributes'] );
     379            }
     380        }
    376381
    377382        /**
Note: See TracChangeset for help on using the changeset viewer.