I am currently creating a post programmatically, with the wp_insert_post
function but am having some difficulties when adding two variables into the content part of the array. I would like to add $_POST['poll-description']
as well as the code I am currently using '[poll id=' . $latest_pollid . ']'
to be the post content.
Is there any way I can use both of these in the following code?
$post_id = wp_insert_post(
array(
'comment_status' => 'open',
'ping_status' => 'closed',
'post_author' => $current_user->ID,
'post_name' => $slug,
'post_title' => $pollq_question,
'post_status' => 'publish',
'post_type' => 'post',
'post_content' => '[poll id=' . $latest_pollid . ']'
)
);
Would this work?
`post_content' => $_POST['poll-description'] '[poll id=' . $latest_pollid . ']'`
$_POST['poll-description']
to go before the shortcode.