bp_get_group_type_key( $post_id )
Return group type key.
Description
Parameters
- $post_id
-
(Required)
Return
(mixed|string)
Source
File: bp-core/deprecated/buddyboss/1.1.8.php
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | function bp_get_group_type_key( $post_id ) { if ( empty ( $post_id ) ) { return '' ; } $key = get_post_meta( $post_id , '_bp_group_type_key' , true ); // Fallback to legacy way of generating group type key from singular label // if Key is not set by admin user if ( empty ( $key ) ) { $key = get_post_field( 'post_name' , $post_id ); $term = term_exists( sanitize_key( $key ), 'bp_group_type' ); if ( 0 !== $term && null !== $term ) { $digits = 3; $unique = rand(pow(10, $digits -1), pow(10, $digits )-1); $key = $key . $unique ; } update_post_meta( $post_id , '_bp_group_type_key' , sanitize_key( $key ) ); } return apply_filters( 'bp_get_group_type_key' , $key ); } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.