I want to check in wp if post content includes gx-block class.
For example I can have
class="something_can_exists_or_not gx-block something_else" should print *true*
class="gx-block" *true*
Etc.
I have tried this but doesn't work
preg_match('/class="?.*gx-block?.*"/i', $content);
Thanks
I don't think that regular expression is right tool for the job. As the HTML is not regular language.
Anyway you could do some think like this:
https://3v4l.org/ORKkR
I would recommend doing it by DOM access instead as described here: Getting DOM elements by classname