Home › Forums › ACF PRO › Local JSON in plugin not load › Reply To: Local JSON in plugin not load
Hello all. I understand this topic seems closed, but I’m hoping you folks can help me resolve this. I want to load my field group json file which lives in a folder within my plugin. Let me explain my setup.
There are only two active plugins, ACF and my very simple custom plugin (which only attempts to load a json field group).
Here’s a look at the .json file. Super simple for testing purposes. And this works if I build it out in the ACF interface. It displays on every page. I exported this group’s json and removed it from the ACF interface. So at this point you don’t see this group in ACF.
[
{
"key": "group_63bc2ff8023f5",
"title": "Test Field Group",
"fields": [
{
"key": "field_63bc2ff682571",
"label": "Test Message",
"name": "",
"aria-label": "",
"type": "message",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "If you're on a page you should see me. Do you?",
"new_lines": "wpautop",
"esc_html": 0
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0
}
]
I placed the following code in my main plugin file.
add_filter('acf/settings/load_json', function($paths){
$paths[] = WP_PLUGIN_DIR .'/gmr-ssp/acf-json';
return $paths;
});
Uploaded everything. Refresh. Nothing. It does not load the field group on the page. The following DOES run and prints the correct paths to the folder where my field group json file resides.
add_filter('acf/settings/load_json', function($paths){
$paths[] = WP_PLUGIN_DIR .'/gmr-ssp/acf-json';
print_r($paths);
die();
return $paths;
});
I just don’t see what I’m missing here.
Any insight would be greatly appreciated.
Thanks!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.