Return to Snippet

Revision: 39003
at January 11, 2011 22:52 by howardpanton


Initial Code
Just paste the following code on your functions.php file:
add_shortcode( 'member', 'member_check_shortcode' );

function member_check_shortcode( $atts, $content = null ) {
	 if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
		return $content;
	return '';
}
Once done, you can add the following to your posts to create a portion or text (or any other content) that will be only displayed to registered users:
[member]
This text will be only displayed to registered users.
[/member]

Initial URL


Initial Description
WordPress shortcode: Display content to registered users only

Initial Title
WordPress shortcode: Display content to registered users only

Initial Tags
wordpress

Initial Language
PHP