Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')'

Weiß ich nicht, was ist falsch mit diesem code:

function my_wpcf7_save($cfdata) {

$formtitle = $cfdata->title;
$formdata = $cfdata->posted_data;   

if ( $formtitle == 'contactform1') {

    //access data from the submitted form
    $formfield = $formdata['name'];

    //create a new post
    $newpost = array( 
                  'post_title' -> $formdata['name']);
                  'post_content' -> $formdata['message']);
                  'post_status' -> 'publish');

    $newpostid = wp_insert_post($newpost);

    //add meta data for the new post
    add_post_meta($newpostid, 'email', $formdata['email']);
    add_post_meta($newpostid, 'subject', $formdata['subject']);
}

}
add_action('wpcf7_before_send_mail', 'my_wpcf7_save',1);

Bekam ich die Fehlermeldung:
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')'
... für diese Zeile: 'post_title' -> $formdata['name']);

Soweit ich weiß, die syntax ist Recht, nicht wahr?

  • Diese Frage scheint off-topic, weil es sich um eine einfache syntax-Fehler. Mit einem richtigen text-editor mit syntax-highlighting.
  • Siehe php.net/array
  • ich ersetzt -> mit => und arbeitet nicht. Ich habe auch entfernt die ";" mit ","
  • Und hast du auch entfernen, die gegen (
InformationsquelleAutor M P | 2013-07-28
Schreibe einen Kommentar