bp_delete_member_type( $post_id )
Remove profile type from users, when the profile type is deleted.
Description
Parameters
- $post_id
-
(Required)
Source
File: bp-core/admin/bp-core-admin-functions.php
2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 | function bp_delete_member_type( $post_id ) { global $wpdb ; $post = get_post( $post_id ); //Return if post is not 'bp-member-type' type if ( bp_get_member_type_post_type() !== $post ->post_type ) return ; $member_type_name = bp_get_member_type_key( $post_id ); $type_term = get_term_by( 'name' , $member_type_name , 'bp_member_type' ); // Get profile type term data from database by name field. //term exist if ( $type_term ) { //Removes a profile type term from the database. wp_delete_term( $type_term ->term_id, 'bp_member_type' ); //Removes a profile type term relation with users from the database. $wpdb -> delete ( $wpdb ->term_relationships, array ( 'term_taxonomy_id' => $type_term ->term_taxonomy_id ) ); } } |
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.