Hide menu theme location for certain capabilities?

Check user capabilities or roles when registering the navigation menu. The data will remain accessible via wp_nav_menu, but users without the capabilities won’t see the location in Appearance -> Menu -> Manage locations. Note this will only prevent assigning menus to these locations. Any menu assigned to the location already will be manageable (if the … Read more

Subscriber role – blank page

I found an answer. It is because the WooCommerce plugin which prevents users without edit_posts capability to display dashboard. Well, I think they should let you know that they are making this kind of change in WordPress default settings. Because you are not able to turn it off in WooCommerce settings.

Changing capability type without altering plugin

you can achieve this one by adding one plugin “user Role Manager” Link for It https://wordpress.org/plugins/user-role-editor Steps Install user Role Manager First. and activate it. Create custom role or Edit Subscriber default role to set that page edit permission Set default role in setting as custom role if custom role created. Its Done.

Run only on plug-in activation instead of wp_head

That depends on whether your plugin is written in a procedural or object oriented style. register_activation_hook is what you want. https://codex.wordpress.org/Function_Reference/register_activation_hook How exactly you incorporate it depends on your plugin coding style. Examples listed in the Codex show multiple approaches. Procedural example: If you have a function called myplugin_activate() in the main plugin file at … Read more

How to add a menu page for options in wordpress for user that has the role of vendor?

The third argument to add_menu_page() is $capability. add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); That governs who can see the page. You’ve registered yours as “administrator”, which is a user role. Presumably your vendors are not of that role. To fix this, you will need to change that argument to a capability (preferably … Read more