bbp_update_topic_id

Update a posts topic meta ID.

Description

bbp_update_topic_id( (int) $post_id, (int) $topic_id ); 

Parameters (2)

0. $post_id (int)
The post to update
1. $topic_id (int)
The topic id.

Usage

  1. if ( !function_exists( 'bbp_update_topic_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/functions.php'; 
  3.  
  4. // The post to update 
  5. $post_id = -1; 
  6.  
  7. // The topic id. 
  8. $topic_id = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bbp_update_topic_id($post_id, $topic_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/core/functions.php  
  1. function bbp_update_topic_id( $post_id, $topic_id ) { 
  2.  
  3. // Allow the topic ID to be updated 'just in time' before save 
  4. $topic_id = apply_filters( 'bbp_update_topic_id', $topic_id, $post_id ); 
  5.  
  6. // Update the post meta topic ID 
  7. update_post_meta( $post_id, '_bbp_topic_id', (int) $topic_id );