Problem Using Advanced Custom Fields with Envira

We had a client using the free version of Envira Gallery who wanted a custom gallery display. Our template would display galleries based upon a category and allow for a cover photo as well. To accomplish this, we had added some Advanced Custom Fields to display on the Envira Gallery add or edit post screen. It worked great.

Then we upgraded to a paid version of Envira to get the Instagram addon. At that point our ACF metabox disappeared. It just stopped showing.

It turns out the Envira Gallery has a function to ‘help you’ remove unwanted metaboxes. Unfortunately, it removes the Advanced Custom Fields metabox. It is up to you to add it back.

Here is the solution:

First you need the id of the field group you wish to display on your Envira Gallery admin post screen. This is not the post id but the long identifier added by ACF. This is easier said than done. We did it by inspecting the metabox using the Chrome inspector. (Just Google browser inspector to get details on how to do this for your browser.)

Then add this to your functions file:

add_filter( ‘envira_gallery_metabox_ids’, ‘az_add_ACF_metabox_back’ );

function az_add_ACF_metabox_back($boxes){

$group = ‘5cfa90a84d6c8’; // your group id here
$boxes[] = ‘acf-group_’.$group; // add the metabox id to the list of allowed metaboxes
return $boxes;