Home Forums Backend Issues (wp-admin) ACF and native Custom Fields (have your cake and eat it too)


ACF and native Custom Fields (have your cake and eat it too)

  • Probably there are others who want to have “native” custom fields as well as Advanced Custom Fields. That is, once you install ACF, you can no longer see native custom fields. However, there is a way to show the custom fields, by adding one line of code to your theme’s functions.php:

    add_filter('acf/settings/remove_wp_meta_box', '__return_false');

    (This is documented at this link.

    However, then you see BOTH the ACF and the native custom fields, which is confusing.

    I wrote a little javascript that will solve this problem, I think.
    When in the Post edit view, it loops through all of the ACF and get the name of each, then finds the “native” custom fields of the same name, and hides them. So far this seems to work.

    /* this script looks at the ACF fields and hides metaboxes of those name*/
    	var mylist = [];
    	$('.acf-field').each( function(i) {
    		mylist.push( $(this).data('name') );
    	// hide native custon fields if they are being used by ACF
    	function hide_native_cf(item, i) {
    		$('#postcustomstuff tr td :input[value="' + item + '"]').parents('tr').hide()

    I am wondering, would this work in a Gutenberg/Block Editor situation? (I’m typically using the Classic Editor.)

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.