Your question is confusing but assuming that you want your array to be an argument set for, say, wp_insert_post()
then…
I am wondering how I can include it into the array for posting with
the content from the string provided in the example.
… you need tax_input
. I am pretty sure I’ve got this right:
$my_post = array(
'post_title' => wp_strip_all_tags( trim( $post_title ) ),
'post_content' => $my_post,
'post_status' => 'publish',
'post_author' => 2,
'post_category' => array( 2 ),
'tax_input' => array(
'genre' => 'abcdefg',
),
'post_date' => date('Y-m-d H:i:s')
);