Home › Forums › ACF PRO › Certain fields not working when imported with PHP › Reply To: Certain fields not working when imported with PHP
I’ve looked into this more and the problem is nothing to do with the names.
It’s if I attach functions to the options.
For example, I have an option called “hide_tools” and then a function like so:
if(get_field('hide_tools', 'options')) {
function remove_admin_menu_items() {
if(!current_user_can('activate_plugins')) {
$remove_menu_items = array(('Tools'));
global $menu;
end ($menu);
while (prev($menu)){
$item = explode(' ',$menu[key($menu)][0]);
if(in_array($item[0] != NULL?$item[0]:"" , $remove_menu_items)){
unset($menu[key($menu)]);}
}
}
}
add_action('admin_menu', 'remove_admin_menu_items');
}
As long as that function exists in my plugin, the “Hide Tools” checkbox doesn’t appear.
This must mean ACF is choking on that function, but this only happens when it is imported using PHP.
What can I do?
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.