mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
REST API: Remove rest_get_post filter and get_post abstraction.
This filter was originally introduced in https://github.com/WP-API/WP-API/pull/2535 to support Customizer Changesets (née Transactions). This is a super broad filter and doesn't really fit with the design of the API, nor is it (arguably) the right level to do this. Props rmccue. Fixes #38701. git-svn-id: https://develop.svn.wordpress.org/trunk@39161 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -72,7 +72,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
|
||||
// Attaching media to a post requires ability to edit said post.
|
||||
if ( ! empty( $request['post'] ) ) {
|
||||
$parent = $this->get_post( (int) $request['post'] );
|
||||
$parent = get_post( (int) $request['post'] );
|
||||
$post_parent_type = get_post_type_object( $parent->post_type );
|
||||
|
||||
if ( ! current_user_can( $post_parent_type->cap->edit_post, $request['post'] ) ) {
|
||||
@@ -153,7 +153,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
return $id;
|
||||
}
|
||||
|
||||
$attachment = $this->get_post( $id );
|
||||
$attachment = get_post( $id );
|
||||
|
||||
// Include admin functions to get access to wp_generate_attachment_metadata().
|
||||
require_once ABSPATH . 'wp-admin/includes/admin.php';
|
||||
@@ -217,7 +217,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
update_post_meta( $data['id'], '_wp_attachment_image_alt', $request['alt_text'] );
|
||||
}
|
||||
|
||||
$attachment = $this->get_post( $request['id'] );
|
||||
$attachment = get_post( $request['id'] );
|
||||
|
||||
$fields_update = $this->update_additional_fields_for_object( $attachment, $request );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user