mardi 22 décembre 2015

update post_author when the array value is 'privato'

in my wordpress site i have 2 type submission form , the first is for already registrated user , the second for private user (not logged)

now i want assign default post author (with id '90' called 'xxx') to a private submission post

a post is a private when

$submission = array(
                'submission_type' => 'privato',);

i have build this code but not work:

$priv = 'privato';

$sub = $submission['submission_type'];

if ($sub == $priv) {

$privateid = get_the_ID(); 

$my_post = array(
      'ID'           => $privateid,
      'post_author'           => 90,
       );


 wp_update_post( $my_post );

} 

how assign/update the post author for the post when the condition is true so $sub == $priv



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire