How to give access to NinjaTables for Other User Role in WordPress

I have launched NinjaTables in WordPress repository few months ago and I got a good responses from the community and It’s amazing that people are happy with it.

By default, Only the Admin User role can manage the table data at WordPress Admin Panel. But If you would like to provide access to other user roles it’s very easy. Mainly You have to hook the `ninja_table_admin_role` filter and return your desired capability name.

Example: Say You want to give access to Admins and Editors for managing your ninja tables, Just open theme’s functions.php file and paste:

add_filter('ninja_table_admin_role', function ($capability) {
	return 'edit_others_posts';
});

Here ‘edit_others_posts’ is the capability name. if You want to give access to authors too just change the capability with ‘publish_posts’, so the code will be

add_filter('ninja_table_admin_role', function ($capability) {
	return 'publish_posts';
});

if You did not try NinjaTables yet, You can download for free from WordPress Repository

Add your first comment to this post