If you’re comfortable using phpMyAdmin, you can run this query:
DELETE FROM wp_posts WHERE post_content LIKE "%A line of same text that should be deleted%"
Replace with the text you’re wanting to remove, but keep the “% %” symbols. The percent symbols mean to search for that string anywhere inside the post content – even if there’s a bunch of other content before and after it.
If you have special characters in the line of text, you may need to escape them.
As with any query, make sure you have a current, working backup before you run this query. 🙂
Related Posts:
- How to display by default only published posts/pages in the admin area?
- Find out who deleted a page or post?
- Post/Page Preview Template
- using wp_update_post on save_post
- Custom permalink structure only for default posts
- Replace image attributes for lazyload plugin (data-src)
- WordPress plugin to publish to multiple remote WordPress blogs
- Any way to create a revision of a post ONLY with a new button in the Meta Box?
- How to display comments and comment form on custom post type?
- How to wrap every image in a post with a div?
- Show One Category on Post
- WordPress Delete hook with wp_delete_post function?
- Custom post type single (permalink) throws a 404 error
- Order post by year DESC and month ASC
- Do I use custom post type or something else?
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- display order of connections
- Delete Post From Front-End and attachment permanently
- if custom post type exist
- How to get a nofication when post submitted
- Custom post type permalinks breaking due to 3.1 bug fix
- ‘Invalid post type’ error when importing from one site to another
- Blogroll – Different layout for first post
- How to delete old posts’ edits to save space?
- Get post id in wordpress action?
- Display page content AFTER a loop of posts
- How can I create custom button in post.php
- how to replace embedded “full” sized images within a post with the “large” ones
- Downgrade user from role that allows post creation
- Remove slashes (both before and after) in relative post url
- Edit custom post type admin menu link
- How to include a post type in the admin/backend?
- How to make number of blog posts a custom field?
- WordPress blog or WordPress website
- Using custom post template
- Hiding Draft Post In Admin
- Adding custom fields to bbpress reply form
- WordPress custom Query for Posts in Category display posts multiple times
- Making a custom Pagination for multi page blog post
- Permission issue with custom post type – not added to menu – by plugin
- Remove Custom Post Type Slug and add Custom Taxonomy to Permalink Structure?
- Add a custom meta box in the post options that loads some html code in the header
- Static posts page with home.php
- Thumbnail & Category link aside post
- Is it possible to customize the post according to post format in single.php?
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- WordPress custom post type with folder structure in slug
- Using setup_postdata() with multi-dimensional array
- How to add automatically bootstrap 4 order-lg-1 and order-lg-2 classes for columns in foreach loop based on the count?
- Show custom post with custom categories with specific slug
- Display the 2nd category name of a custom post type without error if its null?
- Querying another post category to match current post and display in loop
- datepicker value in mysql
- Simple Custom Metabox Not Saving
- How to restore deleted post related with deleted users
- Delete post from admin but not from database
- Custom Post Type Single Loop Outputting Wrong Post
- Organization of time insensitive content
- Custom Select Query – Selecting the Year?
- How to output all taxonomy links from a custom post type in a menu?
- Can I style single post that are in multiple catergories?
- WordPress Post Deletion Issue
- How Can I Always Display A Particular Post First Using WP_Query?
- MySQL: Possible to replace all of wp_posts.post_content(id#) via UPDATE + REPLACE + SELECT?
- Change modified date to current date when title updated automatically
- How to put the author of the post in the comments?
- How to add a custom class attribute into code wrapper? [duplicate]
- Redirecting wordpress search query to archive page
- How to create custom search form function including post “tags”
- How to invoke a HTML custom button based on a HTML dropdownlist menu
- Please I want to prefix my WP posts title according to each category
- insert post fails after multiple postings
- Manual Scheduler For Custom Post Type
- Custom Post Type Rewrite URL
- Dev and prod on the same database- dev version active for IOS
- Custom Post Types and Broken Permalinks
- The first post appears twice
- How to delete/customize imported demo content from a theme or add my own?
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- Append a random string to a post permalink
- single- and archive- templates not being applied to custom post types, not even after flushing permalinks
- Show Posts By Custom Field
- Custom Post Type doesn’t use single.php or single-{custom_post_type}.php
- How to retrieve custom field values and save again as array
- Is there a Standard Format for Clean URLs for Archives of Custom Posts?
- How can I have the posts from one word press blog show on the presentation page of another word press site
- Customize search results to include custom posts and display in a specific template page
- Custom permalink based on custom post type fields
- Checking if some condition is matched before inserting post into database
- How to only allow post to be deleted if custom field doesn’t exist
- Show a Category Specific Info Box
- Custom Post Title as search term
- adding custom meta as well as looping through posts
- Best way to enable sorting by 3 criteria on a page of listings
- How to show only the date, the title and a little “summary” of my WordPress post in my custom theme?
- How remove “recent comments” title without modifying code? [closed]
- How edit footer copyright info? [closed]
- Notify/check if the content of a custom gutenberg block has changed on save_post
- WordPress Custom Post type csv exporter
- Edit Page button is gone