the_excerpt - want to modify password protected output (1 post)

  1. cmegown
    Posted 4 years ago #

    Hey everyone,

    I'm looking to modify the output of the_excerpt when there isn't an excerpt specified and the post is password protected. I already can modify the password protected form to whatever I want, but the_excerpt is outputting "There is no excerpt because this is a protected post.".

    The code for this lies in wp-includes/post-template.php:

    function get_the_excerpt( $deprecated = '' ) {
    	if ( !empty( $deprecated ) )
    		_deprecated_argument( __FUNCTION__, '2.3' );
    	global $post;
    	$output = $post->post_excerpt;
    	if ( post_password_required($post) ) {
    		$output = __('There is no excerpt because this is a protected post.');
    		return $output;
    	return apply_filters('get_the_excerpt', $output);

    An easy solution would be to simply change the code in there and move on, but as well all know, changing core files deserves more than a slap across the face! Can anyone help me figure out how to modify this code in my functions.php file?


Topic Closed

This topic has been closed to new replies.

About this Topic