Hook into the_content
before the wpautop
filter has been called, check the post type, and remove the wpautop
filter, which is added in wp-includes/default-filters.php
with the default priority 10
:
add_filter( 'the_content', 'wpse_82860_remove_autop_for_posttype', 0 );
function wpse_82860_remove_autop_for_posttype( $content )
{
# edit the post type here
'post' === get_post_type() && remove_filter( 'the_content', 'wpautop' );
return $content;
}
Related Posts:
- How to remove a filter that is an anonymous object?
- How to add defer=”defer” tag in plugin javascripts?
- How do filters and hooks really work in PHP
- Trouble understanding apply_filters()
- How would one modify the filtering Gutenberg applies to pasted content?
- No filter of code on switch from html to visual editor, how?
- How to modify posts_where filter only for the search query
- How to wrap oEmbed-embedded video in DIV tags inside the_content?
- How to add filter with 2 args?
- WordPress Internal @ Mentions
- is it possible to add “extra” table nav to edit-tags.php screens?
- How to apply the “retrieve_password_message” filter?
- wp_mail – Remove sitename from email subject
- Remove left alignment option in core/image block
- How to change/rewrite the lost password url?
- add_filter multiple times with different addon functions?
- WP Rest API – Upload media without saving attachment post
- Using variable from one filter in another filter
- What effect does the_content filter have on performance?
- add class to term_description
- How can I find out what an `apply_filter` call is actually doing?
- How to apply content filter permanently?
- remove other tabs in new wordpress media gallery
- Customize the “Registration complete. Please check your e-mail.” message on WP 4.0
- posts_groupby problem
- Remove classes from post_class()
- How to stop WordPress from changing ellipsis into a pre-composed triple-dot glyph?
- Replace a part of url generated by get_term_link
- Error when overriding only some audio shortcode HTML output
- Filter category in WooCommerce shop page to display related sub-category
- Run oembed separately outside the_content()
- Hook Into the_content Filter For JSON API Only [closed]
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- How to call a function or method that is Namespaced using another plugin
- Where is the changelog for 3.5? where is the list of added removed files?
- Change username before login
- apply_filters(‘the_content’) – make it ignore shortcodes?
- Replace a word with a word in the URL string
- When does wordpress process <!–nextpage–>
- Remove style `?ver=` from `/wp-admin/upgrade.php`
- Add attribute to script loaded by the theme
- theme_page_templates not working
- Filter custom post type using multiple taxonomy dropdowns
- Add new post with predefined / preset date
- Remove Actions added by SEO ultimate Plugin
- Remove Extra Classes from Post Title
- Building a request processor for multi-page forms, etc using $_GET requests
- Replace audio links with jplayer using the_content filter
- Sorting a specific taxonomy by archive date using URL
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- Modify Redux Framework Options in Child Theme
- How to allow code block in wordpress comments
- Contact Form 7 Custom Validation Doesn’t Get Called [closed]
- Filtering a list of objects with ‘OR’ on the same field
- add_filter to wp_nav_menu_objects having no impact
- How to filter bbPress replies (content)?
- Trimming a custom field to a length
- How to add a filter to the get_body_class function?
- Using add_filter to modify a public function of a class
- How to hide/remove GhostKit component panel in gutenberg block inspector
- Change user nicename without sanitize
- when use function the_content break
- Filter page title (displayed in browser tab) of wp-login
- Adding html banner to posts
- How can I get the default content of WordPress post?
- How do I hide tinymce within the edit screen of a particular page
- What would cause the gettext filter to not work for a given text domain?
- How does wordpress add ‘style’ attribute to element
- How do I safely force get_theme_mod() to use a defined get_option(“stylesheet”) value?
- Shortcode / plugin with custom (flexible) output
- Filter “Your latest posts”
- Is it better to use a constant or apply_filter?
- Hide certain product filters from specific product categories
- Hooked into wp_get_attachment_caption to add content to the default description; not working for jetpack slideshow. Why?
- Add an attribute to the root from functions.php with add_filter
- Would like to use hook or filters to customize email templates
- Removing menus from users other than the administrator
- Can’t understand apply_filter logic
- Remove image of srcset
- Modify oembed code conditionally
- Add option to query string before get_posts() is called on archive.php
- Modify wp headers on specific page
- How can I add a prefix to titles displayed in sidebar using function.php?
- How to make the show as a button?
- List all image sizes still getting disabled sizes
- Why this remove empty paragraphs from the_content does not works?
- Take filter from multiple functions
- wp_editor customization
- What problems could happen if I replaced add_filter and add_action with the function calling
- WP REST API v2. filters doesn’t work
- posts_results filter function memory errors
- Adding to an array & passing it through do_action/apply_filters
- Loading a sidebar on an Ajax call
- the_excerpt() does not work with has_excerpt()?
- Custom excerpt_more filter not working when tag is present
- Taxonomy search filters
- NextGEN Gallery: Adding drop-down menu widget to gallery view without modifying plugin code [closed]
- How do you disable the verification process of user email changes?
- Modify the third (context) parameter in a filter?
- Limit total tags in the_content