Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Forum ID for a Given Topic


  • robsward
    Participant

    @robsward

    Hi,

    How can I move a topic from one forum to another programmatically? I’m hoping to send a post variable with the new forum ID, and then update the topic like so:

    // Update the Status Meta After Changes are Posted
    if ( isset( $_POST['bbps_forum_option'] ) ) {
    
    	$new_forum = $_POST['bbps_forum_option'];
    
    	bbp_update_topic( $this->topic_id, $new_forum );
    
    } // if()

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

  • Robin W
    Moderator

    @robin-w

    The forum is held as the post_parent in wp_posts

    so you would update this

    eg

    // Update topic 37
      $my_post = array(
          'ID'           => 37,
          'post_parent' => 27
      );
    
    // Update the post into the database
      wp_update_post( $my_post );
    
    

    where 27 is the id of the parent forum


    robsward
    Participant

    @robsward

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar