Retrieve multiple values passed to a single attribute in a shortcode (HELP)
Question
I want to write a short code so that users who write their id’s in it can not see the content of the short code! Example:[blacklist_id bl_id=”1,46″]content for white list users[/blacklist_id]
Please help me, I do not know anything about php!
function blacklist_id_func($atts, $content = null) {
global $current_user, $user_login;
if ($user_login)
extract(shortcode_atts(array('bl_id' => '1' ), $atts));
$a = wp_get_current_user();
if($a->ID == $bl_id){
echo 'access denied!';
} else {return ($content);}
}
add_shortcode('blacklist_id', 'blacklist_id_func');
0
4 months
0 Answers
15 views
0
Leave an answer
You must login or register to add a new answer .