Home › Forums › Backend Issues (wp-admin) › adding-custom-settings-fields
https://www.advancedcustomfields.com/resources/adding-custom-settings-fields/
Hi looking at this link, trying to achieve the same from the sample.
I’ve copied the exact code to my functions.php of my child team but it’s not loading, am I doing it wrong?
Please help to advise as it’s my 1st day on ACF n using a mates localhost to test.
I suspect its locahost-child team issue.
However i inserted the code the core funciton file , amazingly the output work fine.
Thanks
Which part of it are you trying to do, not display a field? This does not work… yet.
Returning false from the current version of ACF causes PHP errors. That documentation is actually ahead of the current version and this feature will not be available until version 5.5. The developer was hoping to have it released by now but there have been some delays.
actually, it worked if I hard coded it into the plugin files directly rather then using the functions.php.
is there another way to achieve this ?
make the field admin only, admin to enter at backend and view at the front end.
I tested the ACF-user-role-field-setting-master plugins posted somewhere here but it doesn’t work perhaps cause its localhost ? I’m not sure too.
thanks in advance.
That plugin is mine, you should post an issue over on github if you’re having a problem with it, I thought is was working. I don’t want to use this forum for handling bug reports on and add on. I am currently adding code so that when 5.5 comes out it will use this new method for removing fields. But it will not hide fields on the front end, it’s an “editing” feature.
Hi John, thanks for the plugins, btw i’m not here to seek support for the plugin. will look at the future version. thanks
I’m sure you weren’t, that was just me saying that if you’re having a problem with one of my plugins that I’d really like to hear about it. Eventually, if ACF5 ever makes it to the WP repo I will be putting a lot of my plugins there.
In the mean time, if you want to accomplish this type of admin only field for only a specific field, that plugin show how it needs to be done in the current version and there is code now for when 5.5 is released. In the current version you need to use a hook named ‘acf/get_fields’. This hook is not documented. this hook passes an array of fields and you need to loop though the fields and remove the ones you don’t want to display.
The way that the acf/prepare_field filter is supposed to work makes the process a whole lot simpler.
The topic ‘adding-custom-settings-fields’ is closed to new replies.
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.