Support » Plugin: Random Post on Refresh » How to remove Excerpt if left empty?

  • Resolved ironlion37

    (@ironlion37)


    Hi Micah, I’ve been trying to get the excerpt to stop displaying if the “excerpt” input field for a post is left blank. I’ve been trying everything I could thing of, thinking it was the theme. However, I think I’ve narrowed it down to this plugin.

    I think it’s on line 289 of RandomPostOnRefresh.php. Is it possible to edit that line so that if there is no excerpt entred, none is shown? (instead of generating one automatically)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Micah Wood

    (@wpscholar)

    @ironlion37 Thanks for pointing that out. I’ve released version 1.1.1 to fix this. I’m now generating the excerpt the exact same way that WordPress does. However, WordPress will still inject the post content when the excerpt is empty but it will also truncate at a particular length.

    To disable this and have WordPress NEVER display an excerpt when one is not explicitly provided, I’ve created a little plugin for you that will do this. Just go here: https://gist.github.com/wpscholar/8da60a1f2e1a89d07348491a11725597 and then click on the “Download Zip” button. You can use that .zip file to install the plugin in WordPress via an upload.

    Wow, thanks Micah!

    That really did the trick. I had placed this in my child theme’s functions.php:

    remove_filter( 'get_the_excerpt', 'wp_trim_excerpt' );

    However it wasn’t working. The change you made in this update allows that to work so no excerpt displays when the except input is left blank. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.