Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Joe Consterdine
Joe Consterdine
13,965 Points

User roles in WP when you make a site for a client...

Hi guys,

I've just started creating child themes on WP.

I was wondering, when you make a website for a client and then upload the site on their web hosting how do you go about the user roles?

My initial thought would be you upload the site giving yourself the admin role, and then you add another user role for e.g the Editor role for the client.

The other way would be to upload the site and just have one user role all together and that role to be editor for the client... but then couldn't they just change it to admin role or make a new one as admin?

I obviously want it so they can't mess around or change the theme.

Thanks Joe!

2 Answers

Joe Bruno
Joe Bruno
35,909 Points

Hello Joe,

If it is an individual WordPress Site (as opposed to a multisite WordPress installation), there needs to be an admin on that site not merely an editor. I actually think WordPress requires at least one default admin at all times as this is necessary to activate plugins and themes even though technically you could do this manually through PHP.

One way to restrict access would be to disable the build-in code editors. There's a plugin for that. Another way might be to create a custom user role to best suit your needs. WordPress allows for pretty substantial customization of user role permissions, but ultimately, the question of whether the admin of a site should be you, the client, or both really depends on the nature of the relationship, how much access they want to have, what your policies are as far your own business practices might be, etc.

Technically, however, part of this surrounds the initial set up and terms of your contract or employment. If they own and have paid for the hosting plan directly and it is solely in their name (the domain doesn't matter) as opposed to you buying it, it being in your name, and you leasing that to the client as part of the ongoing service, then legally they really should be an admin with full control of their own product as they are the sole owner.

A way to navigate the legality of this and also perhaps solve your "no monkeying around with the setting" concern - which is incredibly valid! - is to create a "Web Developer" Admin and a "Client" admin. Give the customer BOTH account usernames and passwords, but instruct them to use the "Client" admin (you can name it whatever you want), which has less permissions, for their needs. Should they need to make serious changes, they know they could do that through the other account or employ you (or someone else) to do so. Hope that helps!

Joe Bruno