Role and Capabilities: How do I allow user role to access theme options without enabling 'manage_options'?

admin2025-04-26  7

I'd like to allow a certain user role to access the theme options only.

When I tried this in functions.php, nothing happened:

$limitedadmin = get_role('limitedadmin'); $limitedadmin->add_cap('edit_theme_options'); $limitedadmin->add_cap('edit_themes');

Then when I added this line to the above lines: $limitedadmin->add_cap('manage_options');, it gave the user role access to the theme options but also enabled access to several other options throughout the site like options to several plugins.

How can I just limit access to theme options?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745661052a312745.html

最新回复(0)