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.

8
  • Please explain why you want to do it that way. It could be that you are facing a XY Problem.
    – kaiser
    Commented Feb 15, 2015 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. Commented Feb 15, 2015 at 23:25
  • In other words: You are trying to redirect everybody to the public page (who is not an admin)?
    – kaiser
    Commented Feb 16, 2015 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. Commented Feb 16, 2015 at 0:44
  • Why do they need to have access to the Customizer?
    – kaiser
    Commented Feb 16, 2015 at 0:45

1 Answer 1

1

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

1
  • 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
    Commented May 8, 2019 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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