<?php
/**
* WordPress shortcode only displays content to registered users. Could be improved by
* passing role as an attribute to only allow certain types of users.
*
* Example: [member]This text will be only displayed to registered users.[/member]
*/
function members_only_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return '';
}
add_shortcode( 'member', 'members_only_shortcode' );