You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have a combined number of more than 10 WP Users + Guest Authors that return for the same search string, not all of the results are displayed for the user to choose from. (I.E. 9 WP users and 4 Guest Authors all with "Max" somewhere in the name)
So my question is, why are we specifying'number' => 10, in the $args in the first place? And if there's no reason, then can we remove that? If there is a reason, can we nevertheless have all results returned as expected?
How to reproduce:
Create 6 WP users (editor role) all with first name "max"
Create 5 Guest Authors all with the first name "max"
Either use the UI (search in the Authors metabox) or use the endpoint: /wp-json/coauthors/v1/search/?max
However, you need to make the endpoint public first with:
function make_coauthors_search_route_public( $endpoints ) {
if ( isset( $endpoints['/coauthors/v1/search'] ) ) {
// Set the permission callback to always return true, making the endpoint public
$endpoints['/coauthors/v1/search'][0]['permission_callback'] = '__return_true';
}
return $endpoints;
}
add_filter( 'rest_endpoints', 'make_coauthors_search_route_public' );
Either way, you should observe that not all 11 results are displayed. At least that's what I saw on multiple sites.
The text was updated successfully, but these errors were encountered:
maxledoux
changed the title
Search Author metabox doesn't return all results
Search Author author doesn't return all results, if there are more than 10 results
Sep 6, 2024
maxledoux
changed the title
Search Author author doesn't return all results, if there are more than 10 results
search_authors() function doesn't return all results, if there are more than 10 results
Sep 6, 2024
When you have a combined number of more than 10 WP Users + Guest Authors that return for the same search string, not all of the results are displayed for the user to choose from. (I.E. 9 WP users and 4 Guest Authors all with "Max" somewhere in the name)
The fix is:
Which modifies the
$args
used byget_terms()
here:Co-Authors-Plus/php/class-coauthors-plus.php
Line 1343 in 37065d2
So my question is, why are we specifying
'number' => 10,
in the$args
in the first place? And if there's no reason, then can we remove that? If there is a reason, can we nevertheless have all results returned as expected?How to reproduce:
Create 6 WP users (editor role) all with first name "max"
Create 5 Guest Authors all with the first name "max"
Either use the UI (search in the Authors metabox) or use the endpoint:
/wp-json/coauthors/v1/search/?max
However, you need to make the endpoint public first with:
Either way, you should observe that not all 11 results are displayed. At least that's what I saw on multiple sites.
The text was updated successfully, but these errors were encountered: