wcf7-hide-menu

Remove Contact Form 7 From WordPress Admin Menu

Posted on October 13, 2012 · Posted in Development Tips

The WordPress Contact Form 7 plugin by Takayuki Miyoshi is a simple and fast way to build powerful contact forms for any wordpress website. Sometimes, as developers, we find the need to restrict access to the Contact forms created using Contact Form 7 for a client’s website in an effort to keep them from altering the structure of the forms.

Here is a simple way to remove Contact Form 7 From the WordPress Admin Menu for all users that do not have Admin access to the WordPress dashboard:

/* Remove Contact Form 7 Links from dashboard menu items if not admin */
    if (!(current_user_can('administrator'))) {
	function remove_wpcf7() {
	    remove_menu_page( 'wpcf7' ); 
	}

	add_action('admin_menu', 'remove_wpcf7');
     }

Simply place this bit of code in your functions.php file and you will see the WordPress Contact Form 7 admin menu link disappear for all users other than the admin.