Chapter 8. Users


  • Working with users and user functions

  • Adding, updating, and retrieving user data

  • Developing for roles and capabilities

  • Limiting access with user permissions

  • Customizing user roles

Just a couple of years ago, a chapter on users would probably not have been too exciting to potential plugin developers. At the time, WordPress was largely used as a pure blogging system with one or a few bloggers writing posts. Developing plugins to integrate with the users system most likely wouldn't have earned you a lot of popularity within the plugin community.

Today, WordPress powers many large sites with thousands and even hundreds of thousands of users. Knowing how WordPress handles users is now an important tool in any plugin developer's toolbox. You'll deal with various user scenarios in many of your plugins.

Perhaps, more important, understanding the roles and capabilities system is paramount to developing a solid and secure plugin. Roles and capabilities define what users can do within individual sites created with WordPress.

People use WordPress for private membership sites, social networks, online newspapers, medical databases, centers for education, and much more. All these might require plugins to handle users and permissions. When creating plugins for these types of sites, it's often important to make sure you use the correct WordPress functions so that private information is not shown to users without permission to see it.

This chapter gives you the tools ...

Get Professional WordPress® Plugin Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.