0

我正在尝试为 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 }

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

4

1 回答 1

0

您需要指定一个功能和一个 slug:

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

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

于 2013-04-16T16:04:24.213 回答