Home Forums Backend Issues (wp-admin) Conditional logic from other field group Reply To: Conditional logic from other field group

  • Alright, I came up with something if anybody stumbles upon this topic and has the same problem. Basically, I’m hiding the fields I want to disable using CSS when they’re disabled in the main options page.

    Here goes in functions.php:

    // ACF admin CSS
    function acf_css() { ?>
        <style type="text/css">
        /* checks if option is checked on main option page*/
        <?php if (!get_field('papier', 'options')) { ?>
            /* hides option in admin */
            th[data-name="cache_papier"], td[data-name="cache_papier"] {
                display: none;
        <?php } ?>
    // adds the CSS above to ACF's admin
    add_action('acf/input/admin_head', 'acf_css');

    Of course you need to replace get_field(‘papier’, ‘options’) for the field that disables the other, as well as data-name=”cache_papier” for the field to hide, with your own names if you do it this way. I hope that’s clear 🙂

    It’s not perfect since it’s not actually disabled, it’s just hidden, but it’s better than nothing.