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
324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | 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