Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom meta boxes through action hook {bbp_forum_metabox}


  • Oxibug
    Participant

    @oxibug

    Hi There!

    For guys whom using action hook {bbp_forum_metabox}, It was uses ($post_id) and since v2.6.0 they modify the variable into WP_Post object so if you use {$post_id} to get your custom meta values it won’t work and you must modify it to {$post->ID} instead of {$post_id}.

    I extremely recommended to make two functions using {version_compare} with bbp_get_version() to solve this.

    if( version_compare( bbp_get_version(), '2.6.0', '<' ) ) {
        // Use $post_id
        add_action( 'bbp_forum_metabox', array( $this, 'bbp_forum_metabox' ) );
    }
    else {
       // Use $post->ID
       add_action( 'bbp_forum_metabox', array( $this, 'bbp_forum_metabox_GTv260' ) );
    }
  • You must be logged in to reply to this topic.
Skip to toolbar