bbp_untrash_forum_topics( int $forum_id )
Untrash all topics inside a forum
Description Description
Parameters Parameters
- $forum_id
-
(Required)
Return Return
(If) forum is not valid
Source Source
File: includes/forums/functions.php
function bbp_untrash_forum_topics( $forum_id = 0 ) { // Validate forum ID $forum_id = bbp_get_forum_id( $forum_id ); if ( empty( $forum_id ) ) { return; } // Get the topics that were not previously trashed $pre_trashed_topics = get_post_meta( $forum_id, '_bbp_pre_trashed_topics', true ); // There are topics to untrash if ( ! empty( $pre_trashed_topics ) ) { // Maybe reverse the trashed topics array if ( is_array( $pre_trashed_topics ) ) { $pre_trashed_topics = array_reverse( $pre_trashed_topics ); } // Loop through topics foreach ( (array) $pre_trashed_topics as $topic ) { wp_untrash_post( $topic ); } } }
Changelog Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |