Skip to content

Instantly share code, notes, and snippets.

@sabrina-zeidan
Created July 29, 2017 17:36
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 sabrina-zeidan/4a44f13046a552e4f718c2bb3c9f12e2 to your computer and use it in GitHub Desktop.
Save sabrina-zeidan/4a44f13046a552e4f718c2bb3c9f12e2 to your computer and use it in GitHub Desktop.
Limit post character number with the_content filter for guest users [Wordpress]
add_filter("the_content", "limit_post_content");
function limit_post_content($content){
if (!(is_user_logged_in())){
$content = substr($content, 0, 300);
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment