简体   繁体   中英

Using add_theme_page in Wordpress 3.4

I am trying to add a Theme options page, and this is the piece of code i am using..

add_theme_page('Theme Options', 'Theme Options', 'read', 'theme-option-slug' , 'theme_settings_page');

I am wondering what does the 'read' in the list of parameters mean. Also, If I replace it with Administrator, it does not work.

What all values Can I use to replace the 'read'. I read on Wordpress CodeX, it is the field for Capability. But, entering options like Editor , Administrator , etc in the function does not work.

So, I need to know the exact value of the code I can use....

The Codex has some useful information on what each parameter is, and how it works. As for the 'read' value, you're pretty close in knowing that it's a type of capability that allows only certain users to see that given page.

Unfortunately, you can't define a Role to determine who can and cannot see your page. You have to define a Capability . If you only want somebody with administrative privileges to see your page, you need to select a capability that is unique to the Administrator Role.

Change 'read' to something like 'create_users', and that should do what you need. This Table should help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM