bp_get_member_type not returning value: ‘Invalid Taxonomy’
-
I’m going to break this down as simple as possible, because it’s a little nuts. Using the latest versions of WordPress and BuddyPress, no other plugins unless otherwise mentioned. Default WP theme.
1. Go ahead and register a BuddyPress member type in bp-custom.php like so:
https://gist.github.com/dimensionmedia/c49347c8e24f00f43450b37506b4e0092. Go into your WordPress backend -> users -> extended tab. Assign a user to that member type.
3. Now place this code at the end of functions.php, using the $user_id of the user from #2:
$user_id = 7;
$member_type = bp_get_member_type( $user_id );
echo $member_type; exit;Note this is crude but making it as simple as possible.
Now you won’t get back anything, no matter what you assign the user to as far as user type. The bp_get_member_types() works though. When I attempt to trace through bp_get_member_type back to wp_get_object_terms I get a WP_ERROR of “Invalid Taxonomy”, apparently the $wp_taxonomies doesn’t contain “bp_member_type”.
Please the same code in a front-end template like header.php and this works.
So while i can use the function in templates, i can’t in my plugins (or functions.php).
I’ve used bp_get_member_type() before – in a plugin – and didn’t run into problems. Trying to figure out what i’m missing. Probably something simple.
- You must be logged in to reply to this topic.