Dynamic Options Pages

The Dynamic Options Pages module allows you to register and manage ACF Options Pages from your WordPress admin, in ACF > Options Pages menu.

All ACF settings can be set within the UI. See ACF Options Pages documentation.

Dynamic Options Page

(string) The URL slug used to uniquely identify this options page. Defaults to a url friendly version of Menu Title

(string) The title displayed in the wp-admin sidebar. Defaults to Page Title

(string) The capability required for this menu to be displayed to the user. Defaults to edit_posts.

Read more about capability here: https://wordpress.org/support/article/roles-and-capabilities/

(int|string) The position in the menu order this menu should appear. Defaults to bottom of utility menu items.

WARNING: if two menu items use the same position attribute, one of the items may be overwritten so that only one item displays!
Risk of conflict can be reduced by using decimal instead of integer values, e.g. '63.3' instead of 63 (must use quotes).

(string) The slug of another WP admin page. if set, this will become a child page.

(string) The icon class for this menu. Defaults to default WordPress gear.

Read more about dashicons here: https://developer.wordpress.org/resource/dashicons/

(boolean) If set to true, this options page will redirect to the first child page (if a child page exists). If set to false, this parent page will appear alongside any child pages. Defaults to true

(int|string) The '$post_id' to save/load data to/from. Can be set to a numeric post ID (123), or a string ('user_2'). Defaults to 'options'.

(boolean) Whether to load the option (values saved from this options page) when WordPress starts up. Defaults to false.

(string) The update button text.

(string) The message shown above the form on submit.

Export/Import Block Types

It is possible to export and import Options Pages in a Json file using the ACF > Tools menu. Options Pages can also be exported in PHP format, to manually register them in the functions.php file. Those tools are also available directly within the Dynamic Options Pages UI.

Settings in PHP

The Dynamic Options Pages UI use the acf_add_options_page() function behind the scene. It is possible to change the settings in PHP using the acf/get_options_page hook. Usage example:

add_filter('acf/get_options_page', 'my_acf_get_options_page', 10, 2);
function my_acf_get_options_page($page, $slug){
    
    if($slug !== 'my-options')
        return $page;
    
    $page['page_title'] = 'My Options';
    
    return $page;
    
}

Disable the module

This module is enabled by default. To disable it, you can use the following code:

add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){

    // Disable Dynamic Options Pages
    acfe_update_setting('modules/dynamic_options_pages', false);
    
    // Or:
    acf_update_setting('acfe/modules/dynamic_options_pages', false);
    
}