ap_unset_selected_answer( integer $question_id )
Description #
Clear selected answer from a question.
Parameters #
- $question_idinteger (Required) Question ID.
Changelog #
Source #
File: includes/qameta.php
function ap_unset_selected_answer( $question_id ) { $qameta = ap_get_qameta( $question_id ); // Log to activity table. ap_activity_add( array( 'q_id' => $question_id, 'a_id' => $qameta->selected_id, 'action' => 'unselected', ) ); // Clear selected column from answer qameta. ap_insert_qameta( $qameta->selected_id, array( 'selected' => 0, 'last_updated' => current_time( 'mysql' ), ) ); $ret = ap_insert_qameta( $question_id, array( 'selected_id' => '', 'last_updated' => current_time( 'mysql' ), 'closed' => 0, ) ); $_post = ap_get_post( $qameta->selected_id ); /** * Action triggered after an answer is unselected as best. * * @param WP_Post $_post Answer post object. * @param WP_Post $question_id Question id. * * @since unknown * @since 4.1.8 Moved from ajax-hooks.php. */ do_action( 'ap_unselect_answer', $_post, $question_id ); return $ret; }
Expand full source code Collapse full source code View on GitHub: includes/qameta.php:324
Add your comment