Closed serkan-asquared closed 2 years ago
Thanks for your report!
Since WP_Rest_Users_Controller
is a class from WordPress core, this might not be an issue with the Web Stories plugin, but a conflict somewhere else.
To confirm this, can you test whether this still happens with all other plugins disabled and when using a different theme?
Hi @swissspidy I can verify this still happens when other plugins are inactive and default theme is in use.
That's very strange, because this is impossible without any plugin/theme interference.
Can you perhaps share your Site Health information here? This way we can learn more about your setup and things like mu-plugins.
Hi @swissspidy, our client is hosted on wpvip.com. They have a repo for mu-plugins available here: https://github.com/Automattic/vip-go-mu-plugins
Hmm, I found out that this is the cause of the issue:
function sstk_rest_user_query( $prepared_args, $request ) {
if ( array_key_exists( 'who', $prepared_args ) && array_key_exists( 'number', $prepared_args ) &&
'authors' === $prepared_args['who'] && 100 === $prepared_args['number']
) {
unset( $prepared_args['number'] );
}
return $prepared_args;
}
add_filter( 'rest_user_query', 'sstk_rest_user_query', 10, 2 );```
Where is this code coming from?
This is a piece of code we added as the client has large number of authors and they are not showing up on Gutenberg editor. This code removes the limitations.
If we could differentiate post types at this filter, we can add a conditional.
I see.
Are you sure you still need that? Gutenberg nowadays has an improved author dropdown with search functionality.
If you want to keep it, you can use the $request
object to determine whether this was coming from Web Stories or not, based on the route.
Bug Description
Trying to open the web stories editor.
Steps to Reproduce
Getting the below Call Stack
Call stack:
WP_REST_Users_Controller::get_items() wp-content/plugins/web-stories/includes/REST_API/Stories_Users_Controller.php:105 Google\W\R\Stories_Users_Controller::get_items() wp-includes/rest-api/class-wp-rest-server.php:1143 WP_REST_Server::respond_to_request() wp-includes/rest-api/class-wp-rest-server.php:990 WP_REST_Server::dispatch() wp-includes/rest-api.php:519 rest_do_request() wp-content/plugins/web-stories/includes/namespace.php:218 Google\W\rest_preload_api_request() array_reduce() wp-content/plugins/web-stories/includes/templates/admin/edit-story.php:158 require_once() wp-content/plugins/web-stories/includes/Admin/Editor.php:239 Google\W\A\Editor::replace_editor() wp-includes/class-wp-hook.php:307 WP_Hook::apply_filters() wp-includes/plugin.php:191 apply_filters() wp-admin/post.php:182
Screenshots
Additional Context