1

I'm using a theme that has a very robust customizer and I want users other than an admin to be able to use the customizer so they can customize what their site looks like. The URL for the customizer is at: http://localhost/mulitsite1/wp-admin/customize.php

Is there a way that I can give access to this page for someone that has an editor type role without modifying the core Wordpress wp-admin/customize.php file?

EDIT: I looked into the wp-admin/customize.php file and saw the following line of code:

} elseif ( current_user_can( 'edit_theme_options' ) ) {

If I give the user the capability like this:

get_role('subscriber')->add_cap('edit_theme_options');

They have access to the customizer that I want however, I don't want them to be able to switch themes, change widgets, menus or the sidebars so can I only give them access to the customize option?

Since the following line exists on line 15 of the wp-admin/customize.php file:

if ( ! current_user_can( 'customize' ) ) {

I tried to add that as the only capability:

get_role('subscriber')->add_cap('customize');

This didn't give me the access that I needed though.

  • Please explain why you want to do it that way. It could be that you are facing a XY Problem. – kaiser Feb 15 '15 at 23:00
  • @kaiser Ok, basically I'm trying to allow my users to customize their site from outside the wordpress dashboard so they think they aren't using Wordpress. If for some reason a user knows the URL to see the profile.php page within the Admin section I'm trying to limit what they can do. If I only give them the customize capability then I don't have to worry about if they get to the dashboard somehow and what they can do there. – user1048676 Feb 15 '15 at 23:25
  • In other words: You are trying to redirect everybody to the public page (who is not an admin)? – kaiser Feb 16 '15 at 0:23
  • @kaiser Yes but they need to have that capability. I actually asked another question wordpress.stackexchange.com/questions/178214/… to try and ensure that when they cancelled they would go back to the public page and not back into the Dashboard again. – user1048676 Feb 16 '15 at 0:44
  • Why do they need to have access to the Customizer? – kaiser Feb 16 '15 at 0:45
0

Here is my solution and it's worked:

get_role('editor')->add_cap('edit_theme_options');

It's possible since Version 3.0 in Wordpress

| improve this answer | |
  • 1
    OP noted in the question that he already tried it, but as he wrote: I don't want them to be able to switch themes, change widgets, menus or the sidebars. – nmr May 8 '19 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.