Jump to content

Shortcode wordpress only shows content for specific user IDs


Recommended Posts

I'm Shortcode wordpress but it doesn't work, the purpose is to show the content to designated members...

For example: in a post or page, Only allow members id1, id7, id25...Visit, And other members cannot view the content, Please edit it for me...

Thank you.

add_shortcode( 'userid', 'check_user_id' );
function check_user_id($atts, $content = null) {
    if(current_user_id) {return '<p>' . $content . '</p>';}
    else {return "";}
}

[userid_logged_in id = "id1","id7","id25","id27"] 
Content displayed
[/userid_logged_in]

 

Edited by oc1ober
Link to post
Share on other sites

You should really take this to a Wordpress forum or specific Wordpress plugin forum, this forum is web development in general.

That said I would have thought it would be to a integer number 25, otherthan a alphanumeric such as 'id25'.

  • Thanks 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...