Get registered sidebars list in ACF

Hi I’m trying get sidebars list in acf-export.php my function is here

function acf_get_all_sidebars(){
    $sidebars = $GLOBALS['wp_registered_sidebars'];
    $sidebar_options = array();
    foreach ( $sidebars as $sidebar ){
       $sidebar_options[$sidebar['id']] = $sidebar['name'];
    }
    return $sidebar_options;
}

This function is working on page.php or rw-metaboxes but it’s not working in acf. $GLOBALS[‘wp_registered_sidebars’] and $wp_registered_sidebars returning empty array. How can I fix this? Thank you!

Read more here: Get registered sidebars list in ACF

Leave a Reply

Your email address will not be published. Required fields are marked *