Saturday, June 25, 2022
HomeWordPress Developmentdatabase - Utilizing Regex to take away orphan p tags (not empty)

database – Utilizing Regex to take away orphan p tags (not empty)


I used to be utilizing a customized CSV importer to import a specific knowledge set to my WordPress web site. The import is completed and about 700 posts are created. All the pieces is ideal besides some orphan <p> tags are created utilizing tag names contained in the put up.

These paragraphs appear to be this

<p>tag title tag title tag title.</p>

Some are simply

<p>,</p>

So I discovered a plugin known as Search Regex and validated a regex <p>[a-zA-Z0-9.x20]{1,35}</p> to run a search and change. (35 is an arbitrary string size). However the plugin hasn’t up to date in endlessly and would not appear to work.

I made a decision to do it through WP-CLI however realized it requires a distinct format.

Moreover, I’ve some headings of their that begin with the quantity like 1., 2. and many others. – the above regex would clear these out as nicely.

So I need assistance with

Question#1

Finds strings in <p> tags that begin with a quantity 1. and alter the tag from <p> to <h2>

Question#2

Publish that, a regex question that finds <p> between 1 to 35 characters and easily removes them.


Any assist can be appreciated.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments