Skip to content

Instantly share code, notes, and snippets.

@BrumGB
Created January 20, 2020 15:25
Show Gist options
  • Save BrumGB/f316c63bb7cdd888dd77029c00023e60 to your computer and use it in GitHub Desktop.
Save BrumGB/f316c63bb7cdd888dd77029c00023e60 to your computer and use it in GitHub Desktop.
Remove Ninja Forms' 'Add Form' button from TinyMCE - WordPress
<?php
/**
* Remove Ninja Forms' 'Add Form' button from TinyMCE
*/
add_action( 'wp_loaded', function() {
if( ! class_exists( 'Ninja_Forms' ) ) {
return;
}
$inst = \Ninja_Forms::instance()->add_form_modal;
remove_filter( 'media_buttons_context', [$inst, 'insert_form_tinymce_buttons'] );
add_filter( 'media_buttons_context', function() {
wp_dequeue_script( 'nf-combobox' );
}, 999 );
remove_action( 'admin_footer', [$inst, 'output_tinymce_button_js'] );
}, 999);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment