¿Estás usando el Editor Clásico para tu sitio WordPress y quieres eliminar el botón Añadir Formulario del editor TinyMCE? Usando PHP puede desactivar este botón fácilmente. En este tutorial, te mostraremos el fragmento de PHP necesario para eliminar el botón "Añadir formulario" del editor TinyMCE.
Cuando se instala WPForms, un botón Añadir Formulario se mostrará en las opciones del editor TinyMCE para cualquier tipo de entrada de WordPress cuando se utiliza el editor Clásico.
Este botón puede eliminarse fácilmente añadiendo el siguiente fragmento de código a su sitio web.
Eliminar el botón Añadir formulario
En este ejemplo concreto, estamos ocultando el icono Añadir formulario en páginas y entradas. Sin embargo, puede sustituir page
y post
con cualquier nombre de tipo de entrada.
/** * Remove the 'Add Form' WPForms TinyMCE button. * * In the function below we disable displaying the 'Add Form' button * on pages and posts. You can replace 'page' and 'post' with your desired post type. * * @link https://wpforms.com/developers/remove-add-form-button-from-tinymce-editor/ */ function wpf_dev_remove_media_button( $display ) { $screen = get_current_screen(); if ( 'page' == $screen->post_type || 'post' == $screen->post_type ) { return false; } return $display; } add_filter( 'wpforms_display_media_button', 'wpf_dev_remove_media_button', 10, 1 );
Y ya está. Ahora ha desactivado el botón Añadir formulario del editor. ¿Quiere desactivar el autocompletado en los navegadores? Eche un vistazo a nuestro tutorial sobre Cómo deshabilitar el autocompletado en navegadores para campos de formulario.
Filtro de referencia
PREGUNTAS FRECUENTES
P: ¿Puedo utilizarlo para otros tipos de entradas?
R: ¡Por supuesto! En este ejemplo, estamos incluyendo páginas, entradas y el tipo de entrada de producto Woocommerce.
/** * Remove the 'Add Form' WPForms TinyMCE button. * * In the function below we disable displaying the 'Add Form' button * on pages and posts. You can replace 'page' and 'post' with your desired post type. * * @link https://wpforms.com/developers/remove-add-form-button-from-tinymce-editor/ */ function wpf_dev_remove_media_button( $display ) { $screen = get_current_screen(); if ( 'page' == $screen->post_type || 'product' == $screen->post_type || 'post' == $screen->post_type ) { return false; } return $display; } add_filter( 'wpforms_display_media_button', 'wpf_dev_remove_media_button', 10, 1 );