Skip to content

Replace wp_dropdown_users with AJAX-powered user search#191

Open
jdevalk wants to merge 2 commits intodevelopfrom
fix/ajax-user-search
Open

Replace wp_dropdown_users with AJAX-powered user search#191
jdevalk wants to merge 2 commits intodevelopfrom
fix/ajax-user-search

Conversation

@jdevalk
Copy link
Copy Markdown
Member

@jdevalk jdevalk commented Mar 31, 2026

Summary

  • Replaces wp_dropdown_users() in the comment notification recipient meta box with an AJAX-powered search field
  • Prevents high memory usage and page load failures on sites with many users
  • Search is debounced (300ms, min 2 chars), results limited to 20 users, filtered by role

Fixes #190

Test plan

  • On a post edit screen, verify the "Comment Experience" meta box shows a search input instead of a dropdown
  • Type a username — results should appear after 2+ characters
  • Click a result — the user should be selected and the hidden field updated
  • Click "Reset to post author" — selection should clear
  • Save the post and reload — the selected user should persist
  • Test with the comment_experience\notification_roles filter to verify role filtering works

🤖 Generated with Claude Code

Replace the comment notification recipient dropdown with an AJAX search
field to prevent high memory usage on sites with many users.

Fixes #190

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

Test on Playground
Test this pull request on the Playground
or download the zip

@jdevalk
Copy link
Copy Markdown
Member Author

jdevalk commented Mar 31, 2026

@rolf-yoast please let me know if this works for you.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
1 0 1

⚠️ Warnings (1)

📁 comment-hacks.php (1 warning)
📍 Line 🔖 Check 💬 Message
0 textdomain_mismatch The "Text Domain" header in the plugin file does not match the slug. Found "yoast-comment-hacks", expected "comment-hacks".

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@rolf-yoast
Copy link
Copy Markdown

@jdevalk this seems to have fixed it for me. Thanks.

@jdevalk jdevalk requested review from aristath and ilicfilip April 2, 2026 12:25
Signed-off-by: Filip Ilic <ilic.filip@gmail.com>
Copy link
Copy Markdown
Contributor

@ilicfilip ilicfilip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced POST with GET since request doesn't write any data and added a bit of styling for the dropdown selection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Heavy load in post edit pages

3 participants