AnsPress_Hooks::untrash_posts( integer $post_id )
Description #
If questions is restored then restore its answers too.
Parameters #
- $post_idinteger (Required) Post ID.
Changelog #
Version | Description |
---|---|
4.1.2 | Removed @see ap_update_post_activity_meta(). |
4.1.11 | Renamed method from untrash_ans_on_question_untrash to untrash_posts . |
2.0.0 | Introduced. |
Source #
File: includes/hooks.php
public static function untrash_posts( $post_id ) { $_post = ap_get_post( $post_id ); if ( 'question' === $_post->post_type ) { do_action( 'ap_untrash_question', $_post->ID, $_post ); //@codingStandardsIgnoreStart $ans = get_posts( array( 'post_type' => 'answer', 'post_status' => 'trash', 'post_parent' => $post_id, 'showposts' => -1, )); //@codingStandardsIgnoreStart foreach ( (array) $ans as $p ) { //do_action( 'ap_untrash_answer', $p->ID, $p ); wp_untrash_post( $p->ID ); } } if ( 'answer' === $_post->post_type ) { $ans = ap_count_published_answers( $_post->post_parent ); do_action( 'ap_untrash_answer', $_post->ID, $_post ); // Update answer count. ap_update_answers_count( $_post->post_parent, $ans + 1 ); } }
Expand full source code Collapse full source code View on GitHub: includes/hooks.php:358
Add your comment