• i am trying to create my own plugin that has an admin menu, according to codex it should look something like this:

    if (is_admin()) {
    
    	function vb_widget_admin_menu() {
    
    		add_options_page("vBulletin Widget", "vBulletin Widget", 1, "vBulletin Widget", "vb_widget_html_page");
    	}
    
    	add_action('admin_menu', 'vb_widget_admin_menu');
    }

    i keep getting the error: when trying to access my admin page
    You do not have sufficient permissions to access this page.

    ive tried taking away is_admin, i’ve tried changing 1 to administrator or 8.

    any ideas?

Viewing 1 replies (of 1 total)
  • Try this:

    function vb_widget_admin_menu() {
    
    add_options_page("vBulletin Widget", "vBulletin Widget", 1, "vBulletin Widget", "vb_widget_html_page");
    
    }
    
    if (is_admin()) {
    
    	add_action('admin_menu', 'vb_widget_admin_menu');
    }

    That calls your function, if you are logged in as admin. In your code, the function was only created in that case.

Viewing 1 replies (of 1 total)
  • The topic ‘problem creating own wordpress plugin’ is closed to new replies.