admin管理员组文章数量:1193806
My site has a long list of authors. I understand the html is a select list. However, is there any way, javascript or other, to make this a filter-able list, i.e. with a search box at top of the dropdown?
My site has a long list of authors. I understand the html is a select list. However, is there any way, javascript or other, to make this a filter-able list, i.e. with a search box at top of the dropdown?
Share Improve this question edited Sep 22, 2022 at 10:19 Leora Deans asked Sep 22, 2022 at 10:10 Leora DeansLeora Deans 1911 silver badge10 bronze badges1 Answer
Reset to default 0I don't know if this counts as an answer, but I wanted to share in case it is helpful. It looks like you can, although there's an important caveat in that this method needs some fixing to make work.
Here's a blog post that describes how to set up the Select2 JavaScript library to make the user dropdown searchable.
There's too much code to repeat here, I think, but in short, it works like this:
- Hook into the
wp_dropdown_users
function to include the JavaScript files and replace the HTML with something that will work with #2 - Create an AJAX call that can return the list of users into the HTML in #1
- Write the JavaScript to integrate the dropdown with Select2 and make the AJAX call
This is conveniently packaged in a plugin available on GitHub, here.
The caveat: It's quite old and doesn't appear to work anymore, but it may only take some debugging to get it going again. In the Block Editor, it does nothing, but in the Classic Editor, it seems to almost work.
本文标签: adminFiltered dropdown for author
版权声明:本文标题:admin - Filtered dropdown for author? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738414340a2085499.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论