Support » Plugins » custom field still appearing even after field content deleted

  • i have two custom fields with dates in them. sometimes a date range is required, so both fields are populated, and display with an em dash between them. sometimes just one date is required so it’s meant to show without the dash or second date.

    if the second date field was never populated then everything displays as it should. if the second date field was originally populated THEN deleted, the dash still shows even though it shouldn’t (as the field is now empty!)

    // add date range
    $values = get_post_custom_values('start-date');
    // check to see if custom field exists - start date
    if ($values) {
       $postheader .= '<h3 class="dates">' . $values[0];
       $values = get_post_custom_values('end-date');
       // check to see if custom field exists - end date
       if ($values!='') {
          $postheader .= ' &mdash; ' . $values[0] ;
       }
       $postheader .= '</h3>';
    }

    please note that $postheader is defined earlier in the filter code

    example of wrong display: http://www.bfop.org/listing/el-bustas-travelling-photography-studio
    example of right display: http://www.bfop.org/listing/one-day-workshop
    example of full date range: http://www.bfop.org/listing/f16

  • The topic ‘custom field still appearing even after field content deleted’ is closed to new replies.