Image Tag RegEx

//Image Tag RegEx

Image Tag RegEx

The RegEx (regular expression) “/<a[^>]+\><img[^>]+\><\/a>/” can be used to match an image tag inside of an anchor tag, e.g. the typical first image of a post with an embedded image. We need to find them in old posts, to remove them after we’ve added a “featured” image. Best practice now is to have the first image stored as metadata to the post so that it can be used and styled for several different purposes. On our website, we use the Search Regex plugin.

By | 2015-03-07T20:15:59-04:00 March 7th, 2015|Tip|Comments Off on Image Tag RegEx

About the Author: