Created
November 23, 2017 02:58
-
-
Save atultiwari/f99656c899d0f1faef9125d6b0db098c to your computer and use it in GitHub Desktop.
Add question programmatically in Anspress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$question_array = array( | |
'post_title' => $question_title, | |
'post_author' => $user_id_for_question, | |
'post_content' => $question_content, | |
'post_type' => 'question', | |
'post_status' => 'publish', | |
'comment_status' => 'open' | |
); | |
$question_post_id = wp_insert_post($question_array); | |
if ($question_post_id) { | |
wp_set_post_terms($question_post_id, $category, 'question_category'); | |
wp_set_post_terms($question_post_id, $tags, 'question_tag'); | |
$answer_permalink = get_permalink($answer_post_id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment