Forums

Where can i put add_post_meta (1 post)

  1. romain_becket
    Member
    Posted 3 years ago #

    I want to implement a written correspondence between two users of my blog.
    So, sometimes, when the user write a new message, I want to add a the value $autora (post from an other page) to the meta key : 'Destira'

    So, I added :

    'if !(is_null($_POST['Autora'])){

    $autora=$_POST['Autora'];

    add_post_meta($post_ID;,'Destira',$autora);

    }'

    at the beginning of edit-form-advanced.php, just after :
    'if ( ! isset( $post_ID ) )
    $post_ID = 0;
    else
    $post_ID = (int) $post_ID;'

    My issue is that $post_ID = 0 and so the meta value isn't affect to the new post written by the user. Where can I put my piece of code or what can i do to fixe that (How can i get the id of a post not i the database yet?)

    Best regards

Topic Closed

This topic has been closed to new replies.

About this Topic