-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REST issue when activating Gutenberg on IIS #9376
Comments
This also happens after trying to post. |
Note, pages ARE working with gutenberg. I just can't add posts. I'm wondering if this is an issue with the custom post types in the theme. |
Default theme works, so it must be something within my current theme. closing. |
BTW, removing this filter allowed Gutenberg to function: |
Reopening because this should work still. The fact that my theme uses this filter should not cause Gutenberg to break. |
function get_all_posts( $data, $post, $context ) {
} |
It seems the issue is the fact that the data is an array and so get_data and get_links do not accept an array. |
Ok, so it seems returning an array in rest_prepare_posts is an issue. This works:
|
This accomplished it and allowed Gutenberg to function: `function get_all_posts( $data, $post, $context ) {
}` |
You should not be changing the response format of core endpoints so drastically. This is not supported. |
Note, unset doesn't work on _links. Had to remove them manually. There has to be a better way.
|
@TimothyBJacobs what's the proper way to do this? Based on what you're saying, I assume I should be creating a custom route? |
Yes. You should create a custom route in your own namespace. |
@TimothyBJacobs Ok, thanks. I'll try that route. |
Warning: Attempt to modify property 'data' of non-object in C:\inetpub\SERVER_FOLDER\wp-content\plugins\gutenberg\lib\rest-api.php on line 202
Warning: Attempt to modify property 'data' of non-object in C:\inetpub\SERVER_FOLDER\wp-content\plugins\gutenberg\lib\rest-api.php on line 203
Fatal error: Uncaught Error: Call to a member function get_data() on array in C:\inetpub\SERVER_FOLDER\wp-content\plugins\gutenberg\lib\rest-api.php:223 Stack trace: #0 C:\inetpub\SERVER_FOLDER\wp-includes\class-wp-hook.php(286): gutenberg_add_block_format_to_post_content(Array, Object(WP_Post), Object(WP_REST_Request)) #1 C:\inetpub\SERVER_FOLDER\wp-includes\plugin.php(203): WP_Hook->apply_filters(Array, Array) #2 C:\inetpub\SERVER_FOLDER\wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php(1609): apply_filters('rest_prepare_po...', Object(WP_REST_Response), Object(WP_Post), Object(WP_REST_Request)) #3 C:\inetpub\SERVER_FOLDER\wp-includes\rest-api\endpoints\class-wp-rest-posts-controller.php(465): WP_REST_Posts_Controller->prepare_item_for_response(Object(WP_Post), Object(WP_REST_Request)) #4 C:\inetpub\SERVER_FOLDER\wp-includes\rest-api\class-wp-rest-server.php(936): WP_REST_Posts_Controller->get_item(Object(WP_REST_Request)) #5 C:\inetpub\SERVER_FOLDER\wp-includes\rest-api.php(390): WP_REST_Server->dispatch(Object(WP_REST_Request)) #6 C:\inetpub\SERVER_FOLDER\w in C:\inetpub\SERVER_FOLDER\wp-content\plugins\gutenberg\lib\rest-api.php on line 223
The text was updated successfully, but these errors were encountered: