rest-api-enabler breaks /media file upload
-
When activated, the file upload function via /media endpoint will not work. The wp_posts record is created and returned but the file itself will not be written to disk. It seems that the WP_REST_Attachments_Controller is overridden in add_rest_api_support_for_post_type function in class-rest-api-enabler.php:
$wp_post_types[ $post_type_slug ]->show_in_rest = $option['show_in_rest']; $wp_post_types[ $post_type_slug ]->rest_base = $option['rest_base']; $wp_post_types[ $post_type_slug ]->rest_controller_class = 'WP_REST_Posts_Controller';This can be solved by removing the last line:
$wp_post_types[ $post_type_slug ]->rest_controller_class = 'WP_REST_Posts_Controller';
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘rest-api-enabler breaks /media file upload’ is closed to new replies.