In this tutorial I am about to show you two examples how you can use Select2 when creating fields in WordPress admin. We are going to take a look at a meta boxes example specifically but you can easily use it for fields in taxonomies settings or options pages as well.
In this tutorial I am going to show you how you can implement asynchronous posts loading in WordPress or even an infinite scroll.
Please consider that there are could be two different implementation for the AJAX load more button and it depends on a theme you’re using today. For example:
- If you’re using block themes (FSE themes), then the whole implementation comes down to a custom block which will represend our load more button. I am going to talk about it as well.
No matter what way you choose, upgrading your AJAX load more button into an infinite scroll is not a big deal.
There are could be different situations in WordPress when you will need to sort users by registration date. For example you may notice that spam users has been registered recently on your website and it is kind of difficult to find them in your users list because by default it is sorted alphabetically.
In this tutorial we are about to create a “Registration date” column just like on the screenshot below and of course, what is most important we are going to make it sortable.
In order to implement this feature we don’t need to use any plugins (but we could of course), all we need to do is to use three WordPress filter hooks:
manage_users_columns– to add a columnt to All Users page,
manage_users_custom_column– to display the registration date inside it,
manage_users_sortable_columns– to make it sortable.
Let’s get started!
If you don’t know where to insert the code from this tutorial, please check this guide.