You can loop through all your posts and use regex to replace that string. The quick and dirty version would be to just put this in a page template, assign it to a page and then visit said page. If you want something a little cleaner then modify this code to work with something like WP Utility Script Runner.
$posts_to_clean = get_posts(array(
'posts_per_page' => -1,
));
echo 'Posts to clean: ' . count($posts_to_clean) . '<br>';
foreach ($posts_to_clean as $dirty_post) {
$dirty_post->post_content = preg_replace('`(data-src)`', 'src', $dirty_post->post_content);
$updated = wp_update_post($dirty_post, true);
if (!is_wp_error($updated)) {
echo 'Updated post ' . $updated . '<br>';
} else {
echo 'Unable to update post ' . $dirty_post->ID . '<br>';
}
}
echo 'Complete!'
Related Posts:
- What is “Advanced” SQL?
- Oracle SQL query for Date format
- WPDB Insert or if exists Update
- Where are image paths to product category images stored in WordPress database
- Sharing database for collaborative development
- Display data from a non wordpress database on a page template
- Organizing WP Pages based on old website database
- Inserting Post Meta From SQL
- Bulk Update of Custom Post Type Post Status through SQL
- How do I add indexes to WordPress Database?
- Moving an entire wordpress site from one domain to a new domain and database
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Block search SQL from happening
- wpdb query on custom table not working [closed]
- How to execute mulitple statement SQL queries using $wpdb->query?
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Query WordPress database by registered date and role
- Using table lock with wp_insert_post?
- Scheduling posts in database
- Size article thumbnails and retrieve them directly from database
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- wpdb_prepare with multiple or condition
- Uppercase to sentence case for post titles
- SQL Error wp_commentmeta – incorrect table definition
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- How do I get the posts within a certain year/date(with sql query)?
- Export / import WordPress database
- WordPress is not creating table in database after activating plugin,
- Bulk-create posts from SQL database
- Difficulty importing my live site to local
- WordPress Database Huge wp_usermeta Table
- Create table from array with prepare
- Setup private content for specific users with daily updates [closed]
- Which data is written and stored in the database when read-only (non-posting, non-commenting) users visit the site?
- Insert Query not working in the form
- WPDB SQL query with prepare() returning variable, not db value
- Problems with moving my WordPress site to another domain/server
- Why this query is not showing any result on wordpresss home page?
- Is it possible to have more than 1 MySQL database in my WordPress blog?
- pull data from a remote wordpress database
- How to migrate a database from a server to another
- Clear Terms from Taxonomy for Specific Post IDs?
- Is my way to change WordPress server is correct?
- Why does changing Database Table Prefixes result in loss of content?
- Options on how to Display member specific data from a MS SQL database
- Delete/Replace words from X to Y in post content
- SQL query to set posts in bulk based on the post content
- How to delete a particular row in a database table
- Delete all posts that do NOT have a specific tag
- Location of WP default mySQL tables creation file?
- $wpdb->get_var – What value is returned when zero records are found?
- How to display data from db in select list [closed]
- WordPress SQL – How to Check for Category?
- Getting value from database table depending on field value
- custom tables in wordpress Database? (can i just create them with sql?)
- Accidently changed the GUID
- DB prefix not updating
- Deleting empty meta key values
- Sql query to get all metadata for a post
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Job and Employee Performance Tracking with Product Safety
- SQL database import #1046 error
- Help posting values to DB on submit using $wpdb->query
- What’s the easiest way to connect external database and display data on wordpress?
- Is there a way for two deferent themes to consume two different DB on a same WP instance?
- How to set posts to draft in bulk based on the content of the post
- How to create index (sql) to a meta_key?
- 2 $wpdb queries causing error Table ‘wp_postmeta’ is specified twice, both as a target for ‘UPDATE’
- Delete all users meta that named: user_avatar
- Correct and secure way to access a custom SQL database in a custom PHP template file
- How to get specific table by current user login
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- How to retrieve user data based on role using SQL?
- $wpdb not working
- WordPress character set issue
- Link wordpress with a SQl + MongoDB + .NET
- How to add data from wordpress tables to new database tables you have created
- Getting deleted users in database
- Install WordPress with SQL database
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- export individual posts to text files or a single csv file
- SQL query : Select a thumbnail for a media
- why you don’t Implement PDO for access every thing to database
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- Weird WP -Cli Error Connection Refused
- Prevent changing the length of post_name column on WordPress Update
- Get Database Credentials from within the themes file
- WordPress site uses MyISAM, should I switch to InnoDB necessary?
- WP Database Table to CSV file
- Merge two WordPress installations into one, and keep posts separated?
- How can I (semi) automate a database export and import to a different location?
- Improve performance by removing unnecessary database queries
- Is there a way to execute a php script outside WordPress?
- How to save dropdown slection by a user in the DB
- WordPress can’t fetch the posts from the database after moving to new server [closed]
- wp-config was suddenly updated
- Many images in wp-content/uploads folder that are not in Media Library
- Order of search results based off of a backend custom field and also in alpha order
- How to find fresh (last modified) and sql backup?