functions.php
add_filter( ‘job_manager_field_editor_js_conf_meta_keys’, ‘smyles_allow_featured_image_admin_only’ );
/**
* Allow featured_image to be set as admin only
*/
function smyles_allow_featured_image_admin_only( $config ){
// Make sure admin_only_0 is in disabled fields first (_0 added for any checkboxes)
if( isset( $config[‘featured_image’], $config[‘featured_image’][‘disable_fields’] ) ){
// Flip values to array keys so we can unset admin_only_0 and still retain other values
$flipped = array_flip( $config[‘featured_image’][‘disable_fields’] );
// Remove admin_only_0 from array
unset( $flipped[‘admin_only_0’] );
// Flip back to values
$unflipped = array_flip( $flipped );
// Set modified values
$config[‘featured_image’][‘disable_fields’] = $unflipped;
}
return $config;
}
functions.php
add_filter( 'job_manager_field_editor_js_conf_meta_keys', 'smyles_allow_featured_image_admin_only' );
/**
* Allow featured_image to be set as admin only
*/
function smyles_allow_featured_image_admin_only( $config ){
// Make sure admin_only_0 is in disabled fields first (_0 added for any checkboxes)
if( isset( $config['featured_image'], $config['featured_image']['disable_fields'] ) ){
// Flip values to array keys so we can unset admin_only_0 and still retain other values
$flipped = array_flip( $config['featured_image']['disable_fields'] );
// Remove admin_only_0 from array
unset( $flipped['admin_only_0'] );
// Flip back to values
$unflipped = array_flip( $flipped );
// Set modified values
$config['featured_image']['disable_fields'] = $unflipped;
}
return $config;
}