Created
January 20, 2020 15:25
-
-
Save BrumGB/f316c63bb7cdd888dd77029c00023e60 to your computer and use it in GitHub Desktop.
Remove Ninja Forms' 'Add Form' button from TinyMCE - WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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