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.

  • 1
    What’s the ‘description’? There’s no such field in core WordPress. – Jacob Peattie Oct 22 '18 at 1:13
  • @JacobPeattie Sorry, I meant content. – Edegist Oct 22 '18 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 Oct 22 '18 at 1:37

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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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