Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active October 25, 2019 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/a6fb429499361309fbce8c2a53f63783 to your computer and use it in GitHub Desktop.
Save tripflex/a6fb429499361309fbce8c2a53f63783 to your computer and use it in GitHub Desktop.
Output label even if no value for field when using WP Job Manager Field Editor
<?php
add_filter( 'field_editor_the_custom_field_output_as_false_values', 'smyles_output_label_even_if_no_value', 10, 5 );
function smyles_output_label_even_if_no_value( $false_vals, $field_slug, $job_id, $field_value, $args ){
if( $field_slug === 'job_language' || $field_slug === 'another_field' ){
// This is the original
// $false_vals = array( null, false, array(), '', '-' );
// We remove array() and '' to allow for empty values to still output the label
$false_vals = array( null, false, '-' );
}
return $false_vals;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment