According to the WP-CLI docs for the wp search-replace
command (and wp db search
, for that matter), you have to pass your search string without delimiters and pass any flags separately.
Instead of:
wp search-replace '/<img[^>]+\>/i' '' wp_posts --regex --allow-root
You would use something more like this:
wp search-replace '<img[^>]+\>' '' wp_posts --regex --allow-root --regex-flags="i" --regex-delimiter="https://wordpress.stackexchange.com/"
I just tested this on an install and I’m getting plenty of results.
Edit: WP-CLI indeed does not yet support some sort of limit parameter to only replace the first occurrence. However, I opened an issue for it so it might be possible in the future.
Related Posts:
- How do you add thumbnail support for custom post types?
- Post featured image column on admin post list page
- Custom Field in Featured image for A particular post
- media_handle_upload for local files?
- How to add/assign or change featured image in post programmatically?
- WP-CLI Bulk delete posts from specific category
- How do I use element instead of tags in WordPress post content having webP support?
- VT-resize image and display it [duplicate]
- Posts Page Featured Image [closed]
- Showing Thumbnail from Previous and Next Posts
- How do I programmatically add an image to a post?
- How to Replace the WordPress Featured Image with a Video?
- How to create post in WP network using WP-CLI
- Delete Post From Front-End and attachment permanently
- Require a featured image to publish post
- Underscores.me retrieve next / previous post thumbnail in post_nav function
- How to Set Featured image In WordPress without Showing it into Post?
- How only display all post related to category
- How do I find which articles are missing a featured image in The WordPress database?
- How to access featured image?
- Modify WP_Post before processing
- Show featured image next to post-teasers in Genesis Framework?
- Admin Notices don’t display on the admin screen for certain post
- What is the standard featured image size?
- Errors when uploading images in WP 3.5
- Set size for attachments
- wp-cli post create & media import issues
- why are images not full size?
- Post body text occupying featured image space before it loads
- Get all images in post and comments like Twitter before post title
- Issue where WP Featured Image will not display
- How to check if single.php has already called the_post_thumbnail function
- Getting only the URL of the post thumbnail
- Remove Featured Image & All Media Uploaded to the Post
- Get Post’s first image using Short-code
- related author post thumbnail shows post thumbnail
- Admin – no Featured image choice in create new/page|post
- Post Image not displaying in category view
- preg_replace not removed “class”
- how to give multiple post thumbnails to a post
- How to display post title inside thumbnail?
- Removing all post tags except a given list
- Post Title to featured Image ALT
- Get featured image on hover of post title [closed]
- Remove Featured Image from posts in specific category?
- Retrieve a specific post’s featured image and show on a different page
- Only show featured image on exerpt and exclude images in post
- How to display Post title By ID and its Thumb Contents
- Bulk update published posts date randomly using wp-cli?
- Delete media from the post but keep my featured image and post
- How to automate creating pages on a hosted wordpress from a local set of folders?
- Featured image error after importing blog posts
- Mysql update menu_order problem
- Set featured image as hero image on each page
- Thumbnails and images in the blog post are not loading
- Blog featured images disappeared on my homepage
- post thumbnails error
- Display images of related posts
- Center crop the feature image
- Add another feature image box
- How to show category image if no featured image is set?
- Set featured image on creating new post
- Display post on main page with thumbnail
- How to get all posts in gallery post format template
- Thumbnail With Next/Prev Links Not Showing Next Post?
- How do I get thumbnails?
- Latest news mini images
- Insert link to my thumbnail images
- thumbnail image path and file path for gallery thumbnail images
- Wanting to apply different featured images for each post
- Specific Post Format Image Thumbnail
- Post thumbnail is not shown in wp-admin
- Post thumbnail height problem
- Displaying warning if no featured image has been set – Post Editor
- How enter custom post meta or custom field on box post list archive page?
- $attachment->post_title not displaying title
- Import alt text in set_post_thumbnail
- website images getting corrupt automatically
- Is there an if statement that can determine if a post in the loop is the last post?
- WP_Query: Why is sticky post not first item in loop?
- Is there a way to disable the sticky posts feature?
- Can I load posts via Ajax?
- WordPress Delete hook with wp_delete_post function?
- How to Orderby Comments by post title?
- If modified on same day, show only time
- When creating a post how do you select the format?
- Get URL from all images in a post
- Change the default blog post post attribute template name from “default template” to something else
- How can I get rid of the automatically generating tags?
- How to show a featured image inside a post in only 1 single category
- Custom Post Type Single Loop Outputting Wrong Post
- WordPress Post Deletion Issue
- How to 301 redirect from url with post id to permalink with post name (slug)?
- Create/Set Category as Title of Post
- Blocked posts in network tab
- How Can I Limit Users to Post Creation For My Frontend Theme?
- how to create add-able metaboxes in wordpress post edit screen?
- Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]
- Moving featured image to top of new post editor screen
- Display posts with id equal to relationship value