带有URL参数的wordpress插件中的权限

时间:2013-04-14 15:03:58

标签: wordpress

我正在尝试为wordpress开发一个插件。 一切正常,但当我通过URL传递参数时说:

You do not have sufficient permissions to access this page.

这是我的代码:

<?php add_action('admin_menu', 'theme_options_add_pages');


function theme_options_add_pages() {
    add_menu_page('Theme Options', 'Theme Options', 1, __FILE__, 'main_page');
}



function main_page() { ?>

<div id="theme-options-container">
    <form>
    <div id="theme-options-header">
        <img id="theme-options-logo" src="../wp-content/plugins/theme-options/images/wordpress-logo-hoz-rgb.png" alt="Your logo here"/>
    </div>
    <div id="theme-options-clear">
        <div id="theme-options-sidebar">
            <div class="shadow"></div>
            <ul role="navigation">
                <li id="theme-option-general">
                    <a href="#"><div class="theme-option-image"></div>General Settings</a>
                </li>
                <li id="theme-option-styles">
                    <a href="#"><div class="theme-option-image"></div>Styling Options</a>
                </li> 
            </ul>
        </div>
        <div id="theme-options-content"></div>
    </div>
</form>
</div>
<?php }

有谁知道我为什么会收到这个错误? 感谢

1 个答案:

答案 0 :(得分:0)

你需要指定一个能力和一个slu ::

add_menu_page( 'Theme Options', 'Theme Options', 'manage_options', 'my-theme-options', 'main_page' );

http://codex.wordpress.org/Function_Reference/add_menu_page