Created
July 29, 2017 17:36
-
-
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]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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