Skip to content

Instantly share code, notes, and snippets.

@maor
Created July 28, 2013 09:13
Show Gist options
  • Save maor/6098045 to your computer and use it in GitHub Desktop.
Save maor/6098045 to your computer and use it in GitHub Desktop.
Conditionally display content depending on whether the user is logged in or not
<?php
// https://www.facebook.com/groups/wordpress.support/permalink/497037907031944
function mc_497037907031944( $content ) {
if ( is_user_logged_in() )
return $content;
else
return 'Sorry, you must be logged in...';
}
add_filter( 'the_content', 'mc_497037907031944' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment