After I updated my WordPress to 4.2.2

I minified my code :

<?php while( $teamGroup->have_posts()) : $teamGroup->the_post(); ?>
    if (get_the_excerpt()) { ?>
    <?php echo get_the_excerpt(); ?>
  <?php } ?>
<?php endwhile;?>

I'm getting the excerpt from here:
enter image description here

But if excerpt is empty I got this unwanted text <!-- value: -->

  • That is neither Core WordPress nor PHP. It looks like an HTML comment but I am betting that it is a kind of markdown. What plugins are you running?
    – s_ha_dum
    Jun 11, 2015 at 13:47
  • Assuming you don't want to show something else when the excerpt is empty. (else you would have taken care for it?!) Try a filter to see if it shows a msg in return when left empty(empty excerpt is meant here)
    – Charles
    Jun 11, 2015 at 16:02
  • if (strpos($my_excerpt,'<!-- value') !== true) { (PHP) I just filter it with this statements
    – Jows
    Jun 11, 2015 at 16:06
  • But how did that markup get in there in the first place? And then remove it or fix what is broken. That is the correct approach to solving this problem.
    – s_ha_dum
    Jun 11, 2015 at 16:33

1 Answer 1


This little function I created to see what happends when...
Outcome here was showing the excerpt as wished when filled out in backend and if left empty it keeps blank.

I have no idea why you have filter it that way but that is the way you wish I assume.

add_filter( 'get_the_excerpt', 'if_excerpt_left_empty_show_this' );
function if_excerpt_left_empty_show_this( $excerpt ) {

   if (strpos($excerpt,'<!-- value') !== true) {
       return $excerpt;

Maybe it helps a little? If totally incorrect, please do say and I will delete it.

  • This will ameliorate the issue, but the fix would be to find out why that content is in the excerpt and remove the source of the problem. +1 though
    – s_ha_dum
    Jun 11, 2015 at 17:44

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.