Open petmyrhino opened 5 years ago
This is bothering me too. It just doesn't make sense to limit the displayed authors to 100 entries. At least for the categories there's a way of searching for the others.
Until this is fixed, I added the following filter to one of my mu-plugins
to remove the limit to 100 users and display all of them.
add_filter( 'rest_user_query', function( $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;
}, 10, 2 );
a bit hackish, I know, but it can be easily removed once this issue is fixed.
@mwidmann , I have tried various solutions and filters but whenever I use the filter, I get an empty response. Are you still using the same filter?
@serkan-asquared yes, still using it and seems to work quite fine in WordPress 5.7. It is in the starter file of one of the plugins we have enabled. Not inside any hook or action. Maybe you call it at a wrong time?
+1 from me. I think it is totally fine to initially load only some authors or categories but please load more if we scroll to the end of the list.
A small update. With WordPress 5.8 there's a way to filter the list by typing a partial name of the author. This should partially solve the initial issue with the list not being complete.
The filter I posted here introduced a new set of issues as unsetting $prepared_args['number']
led to a division by zero warning in class-wp-rest-users-controller.php
. While not breaking the functionality, it is still a bad thing to have this lying around.
Therefore the new version is:
// removes the limits applied to calls to the users rest api to avoid issues with gutenberg not showing all
// registered editor users. see https://github.com/WordPress/gutenberg/issues/15994
add_filter( 'rest_user_query', function( $prepared_args, $request ) {
if ( array_key_exists( 'who', $prepared_args ) && array_key_exists( 'number', $prepared_args ) &&
'authors' === $prepared_args['who'] && 100 === $prepared_args['number']
) {
$prepared_args['number'] = 5000;
}
return $prepared_args;
}, 10, 2 );
5000 is just an arbitrary high number which will never be reached in our case.
Describe the bug When adding a new post (/wp-admin/post-new.php), in the section entitled Document, in the Author scroll box, I have only the first approximately 70 authors out of 150 that write for the site. I am missing half my list to choose from.
Similarly, in the Categories section, I am missing many of the potential categories that are usually listed.
However, if I go to All Posts (/wp-admin/edit.php), and I click quick edit, my categories appear as does my full list of authors.
I would like to restore this functionality to the new post (/post-new.php).
Can anyone please tell me what is going on and how to fix it?
Thank you.
Note that i just moved from a very outdated Go Daddy self directed Linux hosting to Go Daddy Managed WordPress hosting. I was pretty old school and finally caved into getting my ssl and all that.
To reproduce Steps to reproduce the behavior:
Expected behavior I expect to see all the authors listed.
Screenshots
Additional context
Oops that was the wrong screenshot...