Last active
October 25, 2019 17:26
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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