2

How can I check if a custom fiel called description has a heading inside the text?

Take this as an example:

<h2>whatever in the heading</h2>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo
bpy
  • 1,150
  • 10
  • 27

1 Answers1

0

If description is your field name then you can try with this code.

<?php
    $title = get_field( 'description' ); // <h2>whatever in the heading</h2>
    if ( strpos( $title, '<h2>' ) !== false) {
        echo 'H2 is exist.';
    } else {
        //Your Statement
    }
?>
Krupal Panchal
  • 1,553
  • 2
  • 13
  • 26