Custom importer – inline html tags cause new paragraph

[ad_1]

I’m trying to import recipes but having difficulty with the instructions. Inline html tags li <a>, <strong>, or <em> cause a new paragraph.

For example, “Thoroughly combine all the ingredients in a small bowl”

becomes:

Thoroughly combine

all the ingredients in a small bowl.”

My code is below. I would appreciate any insight or guidance.

        $acf_instructions = get_post_meta( $id, 'directions_sections_1_direction_list', true );
        preg_match_all( '!<li>(.*?)</li>!', $acf_instructions, $instruction_matches );

        foreach ( $instruction_matches[1] as $instruction_match ) {
            $instruction_match = trim( $this->derichify( $instruction_match ) );

            $group['instructions'][] = array(
                'text' => $instruction_match,
            );
        }

        $instructions[] = $group;
        $recipe['instructions'] = $instructions;
  • This topic was modified 12 hours ago by joshkern.
  • This topic was modified 11 hours, 59 minutes ago by joshkern.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer