$processor = WP_HTML_Processor::create_fragment( $html ); if ( $processor->next_tag( array( 'breadcrumbs' => array( 'DIV', 'FIGURE', 'IMG' ) ) ) ) { $processor->add_class( 'responsive-image' ); }