0

I am using WP-CLI regex to replace specific tags and the content within the tags. Note that the content between the tags is dynamic so can change.

I want to replace everything between [vc_row el_class= and [/vc_row]

I attempted this with the following regex but the problem is it only matches 5 posts where as it should match over 1000 posts when looking at the database. I suspect the regex is possibly coming across characters it can't match within the tags but not sure of this.

My attempted WP-CLI regex (it only finds 5 posts that match but it should find over 1000 posts)

wp search-replace '\[vc row el_class=[^]]+].*?\[\/vc_row]' '' --precise --regex wp_posts --include-columns=post_content

Content

[vc_row el_class="hero-cta image_flush_bottom" css=".vc_custom_1382221210419{background-color: #511068c !important;}"][vc_column][vc_row_inner el_class="container-row-margin-btm-override"][vc_column_inner width="2/3"][vc_column_text]
<h2><em><strong>Download Guide</strong></em></h2>
[/vc_column_text][/vc_column_inner][vc_column_inner width="1/3"][vc_single_image image="12346" img_size="full" alignment="center" onclick="custom_link" link="https://www.website.com/test-page"] 
[/vc_column_inner][/vc_row_inner][/vc_column][/vc_row]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.