2

Basically, I'm in the process of making a little plugin for my WordPress site, I'm encountering the most annoying problem I can find, My current structure is like such /wp-content/plugins/videos/videos.php

The content inside the PHP file is as follows :

if(!class_exists('WP_GraceMedia_Videos')) {

    class WP_GraceMedia_Videos {

        public function __construct() {
            add_action('admin_menu', array(&$this, 'add_menu_page'));
        }

        public function add_menu_page() {
            $page_title = "GraceMedia Video Management";
            $menu_title = "GraceMedia Videos";
            $capability = "edit_options";
            $menu_slug = "videos/videos-admin.php";
            $function = "";
            $icon_url = plugins_url('videos/images/icon.png');
            $position = "6";
            add_menu_page($page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position);
        }

        public static function deactivate() {

        }

        public static function activate() {

        }

    }

    register_activation_hook(__FILE__, array('WP_GraceMedia_Videos', 'activate'));
    register_activation_hook(__FILE__, array('WP_GraceMedia_Videos', 'deactivate'));

}

It all appears to be correctly formatted to me, It's actually activating the plugin and letting me de-activate it, It's just not adding the item to the WP Admin Menu

4

2 回答 2

3

根据WP Codex,您在add_menu_page代码中拥有的功能“edit_options”不存在。尝试将其更改为“edit_theme_options”之类的内容。

于 2013-07-14T18:24:28.513 回答
1

使用“manage_options”而不是“edit_options”。

于 2017-02-07T10:37:16.123 回答