WordPress.org

Support

Support » How-To and Troubleshooting » WP Insert Post

WP Insert Post

  • Good morning I’m using the latest version of WordPress and one of my present when using the function to insert a post into the database using php programming these are duplicated me, this is that instead of creating only one entry creates two !! ! and do not know how to fix it.

    The code:

    $post = array(
    ‘post_content’ => $descripcion,
    ‘post_title’ => $_POST[‘nombre’],
    ‘post_author’ => $userid,
    ‘post_status’ => ‘draft’,
    ‘post_excerpt’ => $rest,
    ‘post_type’ => ‘ait-item’
    );

    $identificador = wp_insert_post( $post );
    ————————————————————————————————–

    Buenos días ando usando las ultimas versiones de WordPress y en una de mis programaciones actuales al usar la función para insertar un post en la base de datos mediante php estos se me duplican, esto es que en vez de crear solo una entrada crea dos!!! y no se como solucionarlo.

    El codigo:

    $post = array(
    ‘post_content’ => $descripcion,
    ‘post_title’ => $_POST[‘nombre’],
    ‘post_author’ => $userid,
    ‘post_status’ => ‘draft’,
    ‘post_excerpt’ => $rest,
    ‘post_type’ => ‘ait-item’
    );

    $identificador = wp_insert_post( $post );

  • You must be logged in to reply to this topic.