@morgan-estes Great solution but it i think it should be better to add_filter in else so the next block or content gets filter with WPAUTOP
/**
* Try to disable wpautop inside specific blocks.
*
* @link https://wordpress.stackexchange.com/q/321662/26317
*
* @param string $block_content The HTML generated for the block.
* @param array $block The block.
*/
add_filter( 'render_block', function ( $block_content, $block ) {
if ( 'acf/featured-pages' === $block['blockName'] ) {
remove_filter( 'the_content', 'wpautop' );
} elseif ( ! has_filter( 'the_content', 'wpautop' ) ) {
add_filter( 'the_content', 'wpautop' );
}
return $block_content;
}, 10, 2 );
Related Posts:
- How can I put a custom meta box above the editor but below the title section on the edit post page?
- How to make a script load after Custom Block is loaded in the editor?
- Add custom fields within meta box class “on the fly”
- Disable the visibility options in WP
- How to enable the tag in WordPress posts and pages
- How to add button to post page WordPress 5.x
- How to replace default icon on “Add Media” button?
- Why is the new Gutenberg editor so narrow, and how to make it wider?
- Why could I not change the icon of the default Add media button that I added into the toolbar of TinyMCE?
- can’t see all pages in dashboard (can only see 3) /wp-admin/edit.php > 500 error
- WordPress Post Editor Toolbar Missing
- How to add “Check all” to Edit post page in WP?
- How to get value of selected page template in Gutenberg editor?
- Is it possible to “comment out” text in a post?
- Make substitute in all WordPress posts
- editor-style.css Functionality
- Show box only on edit post
- Adding a tooltip above Categories postbox in Post Editor
- YouTube Video autoplay
- Adding content in Gutenberg editor
- How can I define a max width for content in post editor based on a page template?
- wp_update_post() blank screen
- Post editor loads empty
- Word count not accurate – potential bug
- Prepare content from a different CMS/WYSIWYG to the WordPress editor
- find out reason of “Updating failed” in Post-editor
- Notion-like editing and layout with a convenient freeform collaborative editor in WordPress? [closed]
- Admin sidebar overlapping on editor when saving draft
- How can I remove the editor from the ‘main posts page’?
- Theme post editor does not have Visual & Html tabs and all buttons?
- Confirmation message when submitting post for review
- Cannot read properties of undefined (reading ‘show_ui’) Error on WordPress Post Editor
- How to Batch Convert Gutenberg post to Classic post?
- Making custom meta box required (with error message if not filled in) on Gutenberg
- How do I trigger the sidebar reveal for my sidebar plugin in the Gutenberg editor?
- Hide Some Categories in Post Editor
- < ! - - more - - > tag not working
- Block editor: content resets to the previous state in “Edit as HTML” by clicking somewhere outside of the editing window
- Images are not shown in the post editor
- How can I (for the long term) style the classic editor’s TEXTAREA?
- how can i add extra parameter to edit post link?
- Empty paragraphs around figure and figcaption tags when using markdown
- How can I implement a simple post editor?
- How to retain last modification date on draft edit
- wordpress 6.2 is alignfull and lignwide removed?
- Deactivate Gutenberg tips forever – not Gutenberg
- No filter of code on switch from html to visual editor, how?
- Disable Gutenberg text-Settings in all blocks
- New method to disable wpautop after WP 4.3?
- Add additional classes to gutenberg .editor-styles-wrapper
- Remove border radius setting from the Gutenberg button block?
- Get loading state of wp data selector
- wp_editor on front end – JavaScripts not included
- Hide gutenberg option blocks
- WP 5.8 “Query Loop” block: where to place custom query?
- File structure and react setup when creating multiple Gutenberg blocks
- Gutenberg Block manipulation: Undo parse_blocks() with serialize_blocks() results in unicode issues
- What’s the Right Way to get and save remote data for a Gutenberg block?
- fetching via fetch/ajax gutenberg block data from third party
- Gutenberg: Restrict Top Level Blocks, But Not Child Blocks
- Using Gutenberg parse_blocks Function With ACF Custom Blocks?
- Adding a text element in between title and blocks container
- How to replace WordPress sidebars (widget areas) with Gutenberg
- Gutenberg: unable to save attributes with ServerRender
- Register JS for block on frontend only
- How to set Gutenberg preferences programmatically with wp.data.dispatch?
- How do I dynamically render an InnerBlock inside a dynamic block?
- How to output child block attributes on a parent block
- How to add Internationalization in WordPress using Javascript/React?
- How to force gutenberg to reload blocks after saving
- How to display post categories within the Latest Posts block?
- How can I programaticly open Gutenberg
- ResizableBox with RangeControl not working
- Combine multiple getEntityRecords calls
- How to get the Gallery form/section just like in Gutenberg block?
- Set default value for “Additional CSS class(es)” for specific block types
- How do I get the site url from a Block (within the block editor)
- How to add custom table style for table block in gutenberg editor
- Custom Endpoint API based on attribute gutenberg block
- How to hide/remove GhostKit component panel in gutenberg block inspector
- Override theme style rule in Gutenberg
- Is it possible (and how to) query single Gutenberg blocks?
- Gutenberg default attributes are empty when accessing in edit
- Gutenberg selecting child blocks directly from appender
- Custom Block Not Shown in Block Inserter
- Gutenberg build error: You may need an appropriate loader to handle this file type SCSS
- WordPress Gutenberg core/heading block (wp-block-heading)
- Gutenberg block previews suddenly not working
- How can I create more advanced layouts in Gutenberg block editor?
- Get post ancestors in the Block Editor
- How to disable blocks in Gutenberg editor for specific post type
- Possible to make the link autocompleter prioritize Tags before Posts?
- LinkControl not showing suggestions when used on admin page
- Possible to limit internal link search to post types with Gutenberg editor?
- Prevent FormTokenField component to accept random entries
- How to move the customizations done in the Editor to my child theme?
- Custom Fields after update to WordPress 6
- How can I disable fontSizes of the Paragraph block inside the Quote block with theme.json?
- Can’t select my block by clicking on it on apiVersion – but using blockProps
- WordPress custom block: Link saved in database not retrieved when editing post