wp_insert_post() with HTML tags using PHP

Can you try to wrap you wp_insert_post call like bellow:

 kses_remove_filters(); //This Turns off kses
 $post_id = wp_insert_post( $my_post, true );
 kses_init_filters(); //This Turns on kses again

So I tried your code with my method and it perfectly worked. Here is what I did.

$title = "My news";
$content="<p> <img src="https://wordpress.stackexchange.com/questions/368433/img-link"> </p> <p> Hi, this is an example of the content.</p> <a class="dl" href="link-address"> Link Name</a>";

$postData = array(
    'post_title' => $title,
    'post_status' => 'publish',
    'post_content' => $content,
    'post_author' => 1,
    'post_type'         =>   'post',
    'post_category' => array()
);

kses_remove_filters();
$id = wp_insert_post($postData);
kses_init_filters();

It worked perfectly as it should. I’m using Twenty Twenty theme with no plugin enabled.