Hi @elliot
I would expect any custom fields generated by ACF to be hidden from WordPress’ custom fields drop-down list. Especially if these fields are not associated with the post type being edited (i.e. ACF fields assigned to a custom post type should not be visible when editing a page post type).
How this is achieved is not important to me, although using the underscore prefix in the ACF plugin’s code is probably the simplest method.
1 – For all of the custom fields that I control the naming of, I prefixed the key with an underscore (i.e. “_my_custom_field”). This prevents them from being displayed in WordPress’ custom fields drop-down list.
2 – For the custom fields that ACF automatically generates (i.e. when using tabs, ACF uses the “field_51” prefix on the site that I’m working on), I wrote some PHP:
if(!function_exists(‘kc_hide_meta_keys_start’)){
function kc_hide_meta_keys_start( $num ){
add_filter( ‘query’, ‘kc_hide_meta_keys_filter’ );
return $num;
}
add_filter( ‘postmeta_form_limit’, ‘kc_hide_meta_keys_start’ );
}
if(!function_exists(‘kc_hide_meta_keys_filter’)){
function kc_hide_meta_keys_filter( $query ){
remove_filter( current_filter(), __FUNCTION__ );
// Match keys beginning with field_51
$where = “WHERE meta_key NOT LIKE(‘field_51%’);
$find = “GROUP BY”;
$query = str_replace( $find, “$where\n$find”, $query );
return $query;
}
}