WordPress – Page 11

Add ID and Parent Comment ID Columns to the Comments Table in /wp-admin

How to Use Select2 Multiselect in Meta Boxes

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 the first example we will use Select2 to create a multiselect dropdown with tags, in the second one we will do the same for posts, but also with an AJAX search.

Filter Posts and Media Files by a Custom Date Range in Admin Area with no plugins

Weather Forecast Widget / Shortcode

Comment Submission Without Page Refresh. No Plugins Used.

Load More Posts with AJAX. Step by Step Tutorial. Without Plugins

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 old-fashioned themes, then you can create a load more button with a little bit PHP and JavaScript code (and that’s exactly what we’re going to do in this tutorial).
  • 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.

Add a Sortable User Registration Date Column to All Users Page

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.

this is how to sort users by registration date in WordPress admin
On this screenshot the default Posts column is hidden, but the Registration Date column is added. And when you click on its title, the users in this table will be sorted by their registration date — descending or ascending (click the title twice).

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.