bbp_update_forum_id

Update a posts forum meta ID.

Description

bbp_update_forum_id( (int) $post_id, (int) $forum_id ); 

Parameters (2)

0. $post_id (int)
The post to update
1. $forum_id (int)
The forum id.

Usage

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

Defined (1)

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

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