SQL trigger failes with post_content
I’ve written a filter for you. It will filter the character before the post get saved in the database and it’s using the WordPress way. If you use this I think you’re not gonna be needed the trigger. Here it is-
add_filter( 'wp_insert_post_data' , 'the_dramatist_filter_content_before_insert' , '99', 2 );
function the_dramatist_filter_content_before_insert( $data , $postarr ) {
$search = array('Â'); // You can add other replacement finding here also
$replace = array(''); // The replacements
$data['post_content'] = str_replace($search, $replace, $data['post_content']);
// Now just return the data
return $data;
}
Hope that thing helps.
Related Posts:
- When is the ‘post_content_filtered’ column in database cleared by WordPress?
- Manually removing revision post types
- Reset/Reorder posts ID in the MySQL wp_posts table
- How do I find which articles are missing a featured image in The WordPress database?
- Remove a shortcode from all WordPress posts
- What do these phpMyAdmin errors mean on my WordPress databaes?
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- Restore woocommerce orders
- How to select particular month post from table and update the post status using MySQL?
- Bulk find & replace on WordPress posts/pages (minus image paths)
- WordPress MySQL Search and replace with wildcard?
- Converting Posts to Pages
- How to change the publishing date of each posts?
- How to get ‘post_content’ without stripping tags?
- Can posts have parents?
- Where is the old post permalink slug stored?
- Separate Database Tables For Different Post Types
- MySQL Query to Retrieve Category from wp_posts
- SQL Query for getting all posts in their latest revised state
- Moving WordPress to new server: no posts found
- Manually delete post from database
- Removing the title attribute from links in the post content
- How to force update all posts after import
- Query All users that has post
- Exporting Data from WordPress into a flat table
- Can’t publish new posts
- Insert posts in two tables
- Instead of submiting an entire post, is there any way to submit a lite-post or a simple message?
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- Exclude posts with empty post_content in wp_query
- How to store an extra (surrogate) ID when creating a post with wp_insert_post?
- Split WP_POST table based on post types
- Most recent post from another database
- What structure should post_content have in the database?
- How to modify post content?
- wp_insert_post – duration
- Which WordPress hook fires after post content loaded?
- After database migration, posts not showing up in dashboard
- Transferring WordPress Database – Serialised data
- Emojis replaced by ‘?’ automatically
- WordPress Local And Live Site
- Creating a post from data returned from HTML form
- Custom order for Mysql array
- wp_posts table: safely remove unused columns to save database storage
- Delete post results in “Cannot delete or update a parent row: a foreign key constraint fails”
- Removing Extra Caption tag around image on post of WordPress
- Is it possible to use WP_Query to only pull posts with attachments?
- Get posts and include taxonomy term
- Inner join overrides Advanced Custom Fields plugin’s get_field [closed]
- Add field to user meta table in database when link is clicked
- How to get post content from an array of ids?
- update image path with words starting uppercase to lowercase chars
- How safe is it to delete old posts edits to save database space?
- Move posts from a non-wordpress site to wordpress
- How to Assign / Move all Deleted post to a category
- Display post number by category
- Saving Post Data in Another Database
- Database hacked – random posts are modified
- Need to change all links in page content but not in post content
- Can’t update WordPress Page if post_content is Empty
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Update field in database for users
- get last post’s link with SQL query
- query for filtering published posts?
- Help on conditional statement to accompany wp_insert_post function please?
- Deleting post tags removes categories
- Is it possible to modify posts table to only read for more recent ones?
- Return records between two meta datetimes saved as strings
- WP query taxonomy optimization
- ACF flexible content block not showing on live site (works locally)
- Add data attribute of post_id for Internal links
- Menu Items disappearing/being empty on save or post edit
- My website is showing today’s date instead of published date since db migration to a new wordpress
- MYSQL: Create SQL query to search for string and replace
- How to setup default value of post_id
- how can i take wordpress post as embed?
- Prevent a post with a specific ID from being created
- Reusing old post IDs
- Trigger on DB make problem on wordpress?
- Comments are in database, don’t show up in WordPress backend or frontend
- Is there a way to save different data when USER interacts with the same POST?
- Add postmeta to all blog posts
- Dev and prod on the same database- dev version active for IOS
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Clean up customize_changeset in DB
- How do I get a certain set of posts from the database?
- get backup file from wordpress database in x days
- I moved my site to another server, wp admin works so does the front page, but posts don’t work
- Can’t seem to replicate permalink structure for localhost development site
- When I click edit on a post, all the content disappear. Does anyone know how to fix this?
- SQL query to remove first image in all posts
- Given two custom post types: Automatically add meta fields from one custom post type to another
- Delete junk text from all the post using my sql command
- How to create a post based on data in a table?
- Is there a maximum amount of pages for a multi-page post?
- If meta_key exists then don’t select this post?
- How to make category for word post_content
- How to update wp_posts with just the returned comment count from wp_comments (SQL GROUP BY)
- Restore posts, but only posts that exist in my database backup
- Change permalinks in posts via SQL