You should use the transition_post_status to filter the content after submitting the post.
Try the below code in the functions.php in your theme:
add_action( 'transition_post_status', '_new_post', 10, 3 );
function _new_post( $new_status, $old_status, $post ) {
if ( 'publish' !== $new_status or 'publish' === $old_status ) {
return;
}
if ( 'post' !== $post->post_type ) {
return;
} // restrict the filter to a specific post type
$plain_content = strip_tags( $post->post_content );
$new_post = array(
'ID' => $post->ID,
'post_content' => $plain_content,
);
wp_update_post( $new_post );
}
Related Posts:
- Generate dormant hook references
- Building a custom REST API
- How to save the values of checkbox to the register setting?
- WooCommerce – how to display product category above product? [closed]
- Why doesn’t the WordPress Importer update posts?
- Creating button next to “add media” that allows you to choose a single post
- WooCommerce create new product and add to cart on form submit
- Extending WC_Cart in woocommerce
- Add new password rule to Ultimate Member register form
- Claim Listing functionality – how to send email to users when their claim has been approved or denied
- Ajax Load More and Masonry: is it possible to load admin-ajax.php in the front end?
- Does the ‘nav_menu_css_class’ filter accept 2 or 3 arguments?
- How does WordPress ensure plugins run at the same time and how does it solve a plugin’s dependency on another one?
- Upload images from custom plugin using the media modal
- Styling readme.html in plugin?
- Follow post plugins for WordPress
- Website dumps encoded result
- Remove obsolete plugins artifacts from database tables
- Can’t get plugin settings page to save data
- Calling custom plugin class methods from a template
- problems with wordpress and php version 5.3.3-1
- My Category is too big on the Menu what can i do?
- Integrating non-WooCommerce and WooCommerce Orders together [closed]
- Hook to plugins admin settings
- Fusion Slider Just keeps loading [closed]
- how to change the verification url of pie register plugin of wordpress?
- (WooCommerce) Remove Sidebar only on Single-Product page
- Own plugin corrups plugin-activation
- Social sharing toolkit is not showing on ajax load
- Owl Carousel2 image not displaying full width when using Stretch row and content, Stretch row and content(no padding) in wordpress
- WpDataTables – View Image Directory
- Masonry images not working
- How to block XML-RPC attack?
- How generate 200% image size and save with suffix @2x
- Force language in translate function
- Using color picker in plugin, does input attribute order matter?
- Can’t send mails wordpress using SMTP authenticate [closed]
- Some recent plugin updates have failed “Could not create directory”
- bbPress plugin: forum lists not showing in correct order? [closed]
- Plugin generated taxonomies’ permalinks with custom placeholders
- Paypal Integration [closed]
- Remove hovercard for only certian gravatars
- wp-custom-menu filter removes the current_page_item class
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- Is there a loading priority for login_enqueue_scripts?
- How to apply lazy loading in background images [closed]
- How can I test plugin activation using phpunit?
- Prevent direct access to WordPress plugin assets?
- WordPress custom taxonomy not showing
- Any reason not to remove all default WP plugins?
- Getting a Page via its post-name using WP REST API v2 and Postman
- A question about register_activation hook
- plugins_url() works everywhere but wp_reqister_script()
- Better WP Security : dashboard doesn’t work any more
- Software to run on server checking outdated wordpress installations
- Integrating boxtal PHP library into a custom WordPress Plugin
- Changing menu order of a specific plugin in dashboard
- Test my WordPress Plugin standard or not
- issue in wp_localize_script
- Sanitize $_GET variable when comparing
- shortcode – multiple instances of same parameter name in one shortcode instance
- I can’t change permalink in WordPress 4.5.3
- WordPress plugin: efficient way to store large data
- Could not add ‘LoginLogout’ link using BAW login logout plugin
- Create a link which allows visitors to disable a plugin?
- login in wordpress using gmail account
- wordpress plugin to manage the layout/design of a theme
- CSS/JS files in WordPress
- Pass PHP variable to javascript
- create pages automatically and dynamically in wordPress
- How to authenticate via API to allow writes/updates
- Removing Plugin Action via Theme for Non-admins
- Problem with wordpress has_action() function
- WordPress – WPBakery – Near Footer jump issue
- Display Woocommerce attribute name above product title
- In woocommerce, is there any way to empty wordpress default mini cart when order placed?
- Override filter variable not working
- Why activated plugin does not appearing in left side menu bar of WordPress admin area?
- WordPress Dashboard shows no plugins installed!
- Yoast Seo Plugin meta title not showoing [closed]
- Why doesn’t a form need an ‘action’ with a plugin that uses the post data?
- URL RewriteRule doesn’t work when using WP Database Participants in my WordPress website
- All plugins deactivated. What could cause this?
- Variable passed to each() is not an array
- product_tag to style an image
- Plugin activated but plugin files nowhere to be found
- Extra Text in Home URL
- Upload images on 3D shape by customers
- Where to find remaining Boldgrid code in WP database?
- how to restore one day before deleted data in wordpress?
- A splash page on landing page
- I cannot login after installing the wp-login timeout setting plugin
- True/False ACF field returning null by default even if default value is true
- Sanitizing, Validating , etc (Plugin)
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- Accessible ‘List Carousel’ block/pattern?
- WP galleries in posts after import. How do I do it?
- How can I create a drawable image for a contact form
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?