2015-11-27 35 views
0

我需要兩個角色才能訪問在wordpress(角色:編輯器和自定義角色)中創建的菜單。我想知道你是否在做這個? 我用它來添加一個角色:在add_menu_page中添加兩個角色

add_menu_page('Test CPF', 'Teste CPF', 'custom_role', 'test_cpf', 'test_cpf', 'dashicons-welcome-write-blog', '19'); 

這方面的工作,但是這隻會增加custom_role鍵入「編輯」不會出現

我嘗試這種解決方案我看了,也沒工作:

add_menu_page('Test CPF', 'Teste CPF', 'custom_role', 'test_cpf*', 'test_cpf', 'dashicons-welcome-write-blog', '19'); 
add_menu_page('Test CPF', 'Teste CPF', 'editor', 'test_cpf', 'test_cpf', 'dashicons-welcome-write-blog', '19'); 

有人幫我嗎?

回答

0

add_menu_page()的第三個參數是「能力」,並且您已將「角色」傳遞給它。語法:add_menu_page($ page_title,$ menu_title,$ capability,$ menu_slug,$ function,$ icon_url,$ position);}}

試試下面的代碼:

add_menu_page('Test CPF', 'Teste CPF', array('edit_others_posts','capability_of_custom_role'), 'test_cpf', 'test_cpf', 'dashicons-welcome-write-blog', '19'); 
相關問題