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

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

WordPress custom admin section

I am going to be working on a website that I will probably be built on WordPress, and I had a question about making custom admin sections.

I know how to add a custom Theme Options page where users can customize different areas of the theme by using get_option['my_options']. For the site, however, they want to have an employee section, so I was thinking of adding a page where the administrator can add and delete employees solely within the admin area. How would one go about adding a page that has a variable number of options like this? Can anyone share any resources about this or point me in the general direction for information?

1 Answer

The fastest way to customize which pages are allowed for specific users is with a plugin like Advanced Menu Editor. this will help remove any pages you have (including custom ones) based on user role.

If you don't want to add a plugin, or need more control, look into creating a custom capability and role for the employee users. You then could your add employee options page call within a conditional...I.e if (current user can ('custom_capability'){add_menu_page...}

Hopefully that makes sense.