1. Home
  2. Snippets
  3. Remove “Add Form” button from TinyMCE editor

Remove “Add Form” button from TinyMCE editor

Heads up!

This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Dismiss

When WPForms is installed, an Add Form button will display in the TinyMCE page/post editor options for WordPress.

Add form button in TinyMCE editor

This button can easily be removed by adding the code snippet below to your site. In this specific example, we’re hiding the Add Form button on pages. However, you can replace page with any post type name.

/**
 * Remove the WPForms TinyMCE media button.
 *
 * In the function below we disable displaying the media button
 * on pages. You can replace 'page' with your desired post type.
 *
 * @param bool $display
 * @return bool
 */
function wpf_remove_media_button( $display ) {

	$screen = get_current_screen();

	if ( 'page' == $screen->post_type ) {
		return false;
	}

	return $display;
}
add_filter( 'wpforms_display_media_button', 'wpf_remove_media_button' );
Updated on April 19, 2018

Was this article helpful?