Created
November 28, 2017 07:05
-
-
Save atultiwari/a7c5cfb43324b08125a2cbec6bd15a02 to your computer and use it in GitHub Desktop.
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
<?php | |
$form = anspress()->get_form( 'answer' ); | |
$values = array( | |
'post_content' => $mcq_answer, | |
'post_type' => 'answer', | |
'post_status' => 'publish', | |
'post_parent' => $anspress_question_id, | |
'comment_status' => 'open', | |
); | |
$form->set_values( $values ); | |
$post_id = AP_Form_Hooks::submit_answer_form( true ); | |
//$post_id = wp_insert_post($values); | |
$answer_permalink = get_permalink($post_id); | |
echo "Post ID : " . $post_id . "<br>"; | |
// Make sure post is inserted. | |
if ( ! is_wp_error( $post_id ) ) { | |
$anspress_answer_posted = true; | |
} else { | |
$anspress_answer_posted = false; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment