WordPress Code Snippets

A fresh mix of code snippets and tutorials

Members-only content via shortcode


Here is a sweet little WordPress shortcode to display content only to logged-in users. Visitors not logged in will see a custom message saying whatever you’d prefer.

To implement, just add the following code to your theme’s functions.php file:

Then you can use it to display content to logged-in users only, like so:

[member]Welcome logged-in user..[/member]

Another example, displaying the content of another shortcode to members only:


Thanks to LapanWebsite for posting this tip on the forums for User Submitted Posts.

Learn more

WordPress Themes In Depth

Show Support

Like our new Facebook Page to show support!