How to add a form to a shortcode in WordPress (using PHP and Ajax)

Recently I needed to develop a Shortcode that would display a form, this blog post details what I did. I used Ajax ( which seems the best way to add forms to shortcodes,┬ábut I’d welcome any input from other developers on your approach). So without further ado lets get on with adding a form to … Read more

How to get a users Roles and how to list all WordPress roles in PHP

This code is handy if you want to find out a users role/s. You could expand it and check if a user has a given role or similar.

This code is based on examples from: https://codex.wordpress.org/Function_Reference/get_userdata and https://wordpress.stackexchange.com/questions/1665/getting-a-list-of-currently-available-roles-on-a-wordpress-site If you did want to check if the user is in a certain group you could … Read more