My plugin have minimum configuration like below.I can see plugin via WP admin under woocommerce main menu.but cannot see plugin from different role.That role can see woocommerce submenu.Only my custom submenu link not visible.
If i directly visit plugin link (domain.com/wp-admin/admin.php?page=report-with-invoice) it says “Sorry, you are not allowed to access this page.”
<?php
/*
Plugin Name:Custom order reports
Plugin URI:
description:Order reports with invoice number
Version: 1
Author: myname
Author URI: https://www.domain.com
License: GPL2
*/
add_action('admin_menu', 'my_admin_menu');
function my_admin_menu() {
add_submenu_page( 'woocommerce', 'Custom Report', 'Custom Report', 'manage_options', 'report-with-invoice', 'report_with_invoice' );
}
function report_with_invoice(){
//my code goes here..
}
?>
Anyone can help me please. I changed file permission to 775 through FTP. still give same error.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
In place of manage_options use the following permission instead: manage_woocommerce:
add_submenu_page( 'woocommerce', 'Custom Report', 'Custom Report', 'manage_woocommerce', 'report-with-invoice', 'report_with_invoice' );
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0