Support

Account

Home Forums Backend Issues (wp-admin) adding-custom-settings-fields

Solved

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

  • i think i posted in the wrong category .apologies

  • 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.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘adding-custom-settings-fields’ is closed to new replies.