2

I am using a plugin, and to get around something I need to add some text to the excerpt field on my posts, but I don't want to display the excerpt field data on the front end, but rather the post content.

Is there a way to stop wp from automatically showing the contents of the excerpt field? css won't work, as I want to display the post content like it would if the excerpt field were empty.

3
  • 1
    What’s the ‘description’? There’s no such field in core WordPress. Commented Oct 22, 2018 at 1:13
  • @JacobPeattie Sorry, I meant content.
    – Edegist
    Commented Oct 22, 2018 at 1:30
  • 2
    WP doesn't display post contents or excerpts, that's the themes job, it sounds like you have theme modifications to make! Without seeing the theme though, or knowing what the plugin is, it's extremely difficult to give advice. Remember, it's better to flood us with information than to try and be helpful and censor what you think is unimportant ( but might actually be super critical and you didn't know )
    – Tom J Nowell
    Commented Oct 22, 2018 at 1:37

2 Answers 2

1

If you want to always return post content when trying to get post excerpt, you can use get_the_excerpt filter like this.

add_filter( 'get_the_excerpt', 'wp256_use_content_as_excerpt', 10, 2 );
function wp256_use_content_as_excerpt( $excerpt, $post ) {
    return wp_strip_all_tags( $post->post_content );
}
0

To display full post content instead of the excerpt in WordPress, you can modify the code in the template file that displays the post on your website. Here are the steps:

Locate the template file for the post display on your WordPress website. The most common file is single.php for single posts, or archive.php for archive pages.

Open the template file in a code editor.

Find the code that displays the post excerpt. This is usually represented by the the_excerpt() function.

Replace the_excerpt() with the_content(). This will display the full post content instead of the excerpt.

Save the changes to the template file and refresh the page to see the updated content display.

Note that this change will affect all posts that use this template file. If you want to only display full content for specific posts, you can use a plugin or custom field to indicate which posts should display full content instead of an excerpt.

I did same for my client website

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.