Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Add custom metadata to forum topics for sorting purposes

@menelik-seth

Member

my tweaks, to get it accepting arrays. Sound code?

`function cg_newmeta( $id, $postcat) {

global $catagory, $wpdb, $bbdb;

do_action( ‘bbpress_init’ );

foreach ($postcat as $value)
{
$wpdb->query( $wpdb->prepare( “INSERT INTO $bbdb->meta ( meta_id, object_type, object_id, meta_key, meta_value ) VALUES (%d, %s, %d, %s, %s )”, $catagory->meta_id, ‘bb_cgcat’, $id, ‘cg_catagory’, $value ) );
}
}

`

Skip to toolbar