How to hide the Contact Form menu item 7
There is a problem in the Contact Form plugin 7, many access control plugins, such as AAM (Advanced Access Manager) cannot restrict ordinary users' access to the Contact Form menu item 7. Plugin developers already know about this problem and promise to fix it, but until they fix it, i want to share the code, which helps solve this problem:
1 2 3 4 5 6 |
if (!(current_user_can('administrator'))) { function remove_wpcf7() { remove_menu_page( 'wpcf7' ); } add_action('admin_menu', 'remove_wpcf7'); } |
To activate this code, you just need to paste it into the file functions.php at the root of your topic.
/*
- Basic web design course;
- Site layout;
- General course on CMS WordPress and continuation of the course on template development;
- Website development in PHP.