[wp-trac] [WordPress Trac] #60317: Cannot select an author from dropdown due to truncated users list
WordPress Trac
noreply at wordpress.org
Sun Mar 2 16:57:24 UTC 2025
#60317: Cannot select an author from dropdown due to truncated users list
--------------------------+------------------------------
Reporter: yanksyoon | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Resolution:
Keywords: | Focuses: ui
--------------------------+------------------------------
Comment (by gorgebilly):
The issue arises because the WordPress REST API's user search is case-
insensitive but looks for the search term anywhere in the user's login,
email, or display name. However, the generated users' names (from the
script) start with "ab" followed by random characters, while the target
user "amailer" isn't appearing due to a possible script error or a search
parameter conflict. Here's the step-by-step
solution:
**Step 1: Verify the Target User Exists Correctly
**
{{{
Check User Creation:
Ensure the amailer user was created successfully using WP-CLI:
bash
Copy
wp user get amailer --allow-root
}}}
Confirm the display_name is amailer and roles include author.
**Step 2: Correct the Script's Username Generation**
The script generates usernames starting with "ab", but your example
response shows names starting with "a" (e.g., a00nBHN2n). Fix the script
to ensure it appends the random string to "ab":
{{{
bash
generate_username() {
username="ab" # Starts with 'ab'
random_string=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 8 | head
-n 1)
username+="${random_string}"
echo "$username"
}
}}}
**Step 3: Debug the REST API Search
**
{{{
Directly Access the REST Endpoint:
Visit the URL in your browser or a tool like Postman:
Copy
http://10.1.190.162/index.php?rest_route=/wp/v2/users&context=view&who=authors&per_page=50&_fields=id,name&search=amailer
}}}
If amailer isn't listed, the user might not exist or the search is
failing.
If unrelated users appear, the search parameter is ignored.
'' Test Search via WP-CLI:
''
{{{
wp user list --role=author --search=amailer --allow-root
If this returns amailer, the issue lies in the REST API
configuration.
}}}
[[Image(ticket:40218:desktop.png, 0px,
link=https://www.christinefrei.de)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.edv-beratung-esl.de)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.golo-mann-
gesellschaft.de)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.hairkapper.de)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.magnosoft.de)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.online-grusskarten.de)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.oper-frankurt.de)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.tableracer.de)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.wattart.de)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.zauberlandcats.de)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.dexternet.nl)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.jeroengerlindeschilt.nl)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.jongehindrikhoeve.nl)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.krantengrap.nl)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.mirjamkloppenburg.nl)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.onafhankelijke-
fractie.nl)]][[Image(ticket:40218:desktop.png, 0px, link=https://www
.stucadoorsbedrijf-vhm.nl)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.newbornart.nl)]][[Image(ticket:40218:desktop.png, 0px,
link=http://www.kongisking.nl/)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.ffinfo.nl)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.cpc-computing.co.uk/)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.first-
wetsuit.co.uk/)]][[Image(ticket:40218:desktop.png, 0px, link=https://www
.dynamo-gfc.co.uk/)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.allsaintsbury.co.uk/)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.tminternational.co.uk/)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.lincolnmodelclub.co.uk/)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.oasisdogbowl.co.uk/)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.dartmoorsafaris.co.uk/)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.jeanchapmancounselling.co.uk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.ok-in-the-
uk.co.uk/)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.efikim.co.uk/)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.brickmoor-
bedandbreakfas.co.uk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.salserareisen.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.scs-drums.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.thunderdome.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.vermisste-kinder.ch)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.rebstock-
frick.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.parfumflacons.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.desert-rats.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.hotelmuveran.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.orion-engineering.ch)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.aikido-
buempliz.ch)]][[Image(ticket:40218:desktop.png, 0px,
link=https://bjornswardshus.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://estart.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://haushornborga.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://hejryssland.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://larecompen.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://malillamkbilklubb.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://olandsaraber.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://skyltotext.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.wallinmynt.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.4pisr.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.projure.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.ingrid-hotell.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.quranaudio.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.soderportsgarden.se)]][[Image(ticket:40218:desktop.png,
0px,
link=https://www.unitedmarketing.se)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.vinofino.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.bokafjallen.se)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.vedskovens.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.3verdensskole.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.aziza-bellydance.dk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.big-bang-nfo.dk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.ds-display.dk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.east-x-net.dk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.egefrim.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.erlingjensen.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.kinojserklubben.dk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.medad.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.nordfyns-
brolaegning.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.proffice.dk)]][[Image(ticket:40218:desktop.png, 0px,
link=https://www.slankekurogsundmad.dk)]][[Image(ticket:40218:desktop.png,
0px, link=https://www.sommerskunst.dk)]]
**Step 4: Check for Conflicts
**
'' Disable Plugins:
'' Temporarily deactivate all plugins. If the user appears, a plugin
(e.g., security or REST-enhancing plugins) is conflicting.
'' Switch to Default Theme:
'' Use a default theme to rule out theme-related issues.
**Step 5: Investigate Custom Code
**
Check for custom filters altering user queries, such as:
php
Copy
{{{
add_filter('rest_user_query', function($args, $request) {
// Custom logic modifying $args
return $args;
}, 10, 2);
}}}
Remove or adjust such code if it modifies the search parameter.
**Step 6: Ensure Correct Case Sensitivity
**
While the REST API search is case-insensitive, ensure no custom code
forces case sensitivity. Add a debug check in rest_api_init to log
queries.
Final Solution
The most likely cause is the script generating users with unexpected
prefixes (not "ab") or search conflicts due to plugins/themes. After
correcting the script and ensuring no conflicts, the amailer user should
appear when searched. If issues persist, manually check the database for
the user’s display_name and user_login in the wp_users table.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60317#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list