bbp_spam_topic_tags( int $topic_id )
Store the tags to a topic in post meta before it’s marked as spam so they can be retrieved and unspammed later.
Description Description
Usually you’ll want to do this before the topic itself is marked as spam.
Parameters Parameters
- $topic_id
-
(Required)
Source Source
File: includes/topics/functions.php
function bbp_spam_topic_tags( $topic_id = 0 ) { // Validation $topic_id = bbp_get_topic_id( $topic_id ); // Get topic tags $terms = get_the_terms( $topic_id, bbp_get_topic_tag_tax_id() ); // Define local variable(s) $term_names = array(); // Topic has tags if ( ! empty( $terms ) ) { // Loop through and collect term names foreach ( $terms as $term ) { $term_names[] = $term->name; } // Topic terms have slugs if ( ! empty( $term_names ) ) { // Add the original post status as post meta for future restoration add_post_meta( $topic_id, '_bbp_spam_topic_tags', $term_names ); } } return array( bbp_get_topic_tag_tax_id() => '' ); }
Changelog Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |