Você está usando o Editor clássico em seu site WordPress e deseja remover o botão Adicionar formulário do editor TinyMCE? Usando PHP, você pode desativar facilmente esse botão. Neste tutorial, mostraremos o snippet PHP necessário para remover o botão "Add Form" do editor TinyMCE.
Quando o WPForms estiver instalado, um botão Adicionar formulário será exibido nas opções do editor TinyMCE para qualquer tipo de postagem do WordPress ao usar o editor clássico.
Esse botão pode ser facilmente removido adicionando o trecho de código abaixo ao seu site.
Remoção do botão Add Form
Neste exemplo específico, estamos ocultando o Adicionar formulário em páginas e posts. No entanto, você pode substituir page
e post
com qualquer nome de tipo de postagem.
/** * 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 );
E é isso! Agora você desativou o botão Adicionar formulário do editor. Gostaria de desativar o preenchimento automático nos navegadores? Dê uma olhada em nosso tutorial sobre Como desativar o preenchimento automático do navegador para campos de formulário.
Filtro de referência
PERGUNTAS FREQUENTES
P: Posso usar isso para outros tipos de postagem?
R: Sem dúvida! Neste exemplo, estamos incluindo páginas, posts e o tipo de post de produto do 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 );