WordPress user has role

In some situations it is very helpful to know whether a WordPress user has a specific role (or not). For example to show a different sidebar based on the user’s role or add a discount to the cart total when the current user is a reseller of your products and you want to give him […]

WordPress get display name

Depending on whether you have the user’s ID (If not, checkout: Get user ID in every situation) you can get the display name by creating the user object first: When the user object is created you can simply obtain the display name from it as follows:

Get user ID in every situation

WordPress offers a number of options to obtain the user ID. There are various options depending on the situation. There are 3 types of situations: A list of users The current logged-in user A specific user A list of users When iterating over a list of users it is pretty simple to obtain the ID […]