Site icon Hip-Hop Website Design and Development

Downside on wpdb queries, wp_insert_post, wp_insert_user and so forth. The question runs twice

Anybody encountered this challenge?

I’ve created a customized php script which provides a brand new submit through the use of wp_insert_post() however everytime I run the code it creates a 2 new submit the place in it must be solely be one, its prefer it runs twice, so I examined one other perform utilizing wpdb->question and its additionally the identical its actually bizarre. Please assist I dont know what causes and the right way to repair this challenge.

Thanks very a lot.

Here’s a pattern code i did simply to check the difficulty and it nonetheless creates 2 equivalent submit

   perform testtest(){
      $ads_data = array(
            'post_title'    => "take a look at",
            'post_content'  => "take a look at",
            'post_status'   => 'publish',
            'post_type' => 'adverts',
            //'post_author' => $user_id
        );

        // Insert the submit into the database
        $ads_id = wp_insert_post( $ads_data );
}add_shortcode('testtest','testtest');

SOLVED

I’ve figured it out now, whats inflicting the difficulty is on my header.php it’s this line of code:

<hyperlink rel="icon" kind="picture/png" href="<?php echo esc_url( get_theme_mod( 'favicon' ) ); ?>" />

I discover it actually bizarre, i do not know why that line of code is inflicting the difficulty, anyway thanks everybody!