Help with this custom field conditional if no field is set display nothing

I prefer empty for this because it considers a lot of things to be “empty” besides just an empty string, and that is the behavior I usually want. Be aware of that though.

I am not 100% sure what you are doing but…

if( empty($swap_value) ) {
  // runs if no $swap_value, or an empty value
}
// OR
if( !empty($swap_value) ) {
  // runs if $swap_value is set to something
}

Reference the PHP Docs for exactly what empty considers “empty” or “not empty”.