Skip to content

Instantly share code, notes, and snippets.

@jaredatch
Last active February 28, 2022 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredatch/07ea7292a1ce655693a14c97f79273d3 to your computer and use it in GitHub Desktop.
Save jaredatch/07ea7292a1ce655693a14c97f79273d3 to your computer and use it in GitHub Desktop.
function user_function_restrict_content( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null($content) && !is_feed() ) {
return do_shortcode( $content );
} else {
return 'Sorry, this content is only available for logged users.';
}
}
add_shortcode( 'member', 'user_function_restrict_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment