I am trying to display a specific 'string' in a PHP array on a wordpress system.
I have a declared a variable $current_user->ID,
that returns the current user e.g. "Admin"
I would now like to try and combine this with normal text in an array to make the text dynamic.
In plain English, I am trying to create something that will display as follows:
Post by: current_user
This is the array I have:
'post_title' => 'Posted By:' . $current_user->ID .'',
but I know that what I have is not correct. The problem lies with connecting the plain text and the variable along with the quote marks.
Can anyone help?
UPDATE - MORE OF CODE:
$post_id = wp_insert_post(
array(
'comment_status' => 'open',
'ping_status' => 'closed',
'post_author' => $current_user->ID,
'post_name' => $slug,
'post_title' => 'Posted By:' . $current_user->ID'',
'post_status' => 'publish',
'post_type' => 'post',
'post_content' => $_POST['quick-post-area']
)
);