Created
January 23, 2013 21:55
-
-
Save stephenharris/4614225 to your computer and use it in GitHub Desktop.
Get membership level ID by Name / Slug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get membership level ID by Name / Slug | |
*/ | |
//Be careful - the name is not unique! | |
$level = wpmember_get_level_by( 'name', 'Basic Subscription' ); | |
if( $level ){ | |
$level_id = $level->term_id; | |
}else{ | |
//Not found! | |
} | |
$level = wpmember_get_level_by( 'slug', 'basic-subscription' ); | |
if( $level ){ | |
$level_id = $level->term_id; | |
}else{ | |
//Not found! | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment