ACF options add submenu with a callback function

Here the code I've just used to add custom sub option page to ACF option page applyed to your exemple. You have to declare your option page twice with the same identifier (in ACF and with the normal way).So, It's a little tricky, but it works :

function add_acf_option_page() {
    if( function_exists('acf_add_options_page') ) {
        acf_add_options_page(array(
            'page_title'    => 'Theme General Settings',
            'menu_title'    => 'Theme Settings',
            'menu_slug'     => 'theme-general-settings',
            'capability'    => 'manage_options',
            'redirect'      => false
        ));
        acf_add_options_sub_page( array(
            'page_title'  => __( 'Books Shortcode Reference', 'textdomain' ),
            'menu_title'  => __( 'Shortcode Reference', 'textdomain' ),
            'parent_slug' => 'theme-general-settings',
            'capability' => 'manage_options',
            'menu_slug'   => 'books-ref-page',
        ) );
    }
}
add_action('acf/init', 'add_acf_option_page' );

function add_custom_option_page() {
    add_submenu_page( 
        null, 
        __( 'Books Shortcode Reference', 'textdomain' ), 
        __( 'Shortcode Reference', 'textdomain' ),
        'manage_options', 
        'books-ref-page', 
        'books_ref_page_callback'
}
add_action('admin_menu', 'add_custom_option_page');

function books_ref_page_callback() {
     ?>
    <div class="wrap">
        <h1><?php _e( 'Books Shortcode Reference', 'textdomain' ); ?></h1>
        <p><?php _e( 'Helpful stuff here', 'textdomain' ); ?></p>
    </div>
    <?php
}

I hope it's help !


You also don't have to do both a parent and a child. I wanted a page to be a sub of another, existing, item (custom post type) so I simply did the below.

To set your page as a child/sub of an existing item (doesn't even need to be an options page, again mine is a CPT) just specify the parent_slug in the acf_add_options_page

'parent_slug'   => 'edit.php?post_type=orders',

Here is all the code

if( function_exists('acf_add_options_page') ) {
    acf_add_options_page(array(
        'page_title'    => 'ACF Options',
        'menu_title'    => 'ACF Options',
        'parent_slug'   => 'edit.php?post_type=orders',
        'menu_slug'     => 'books-ref-page',
        'redirect'      => false
    ));
}
function add_custom_option_page() {
    add_submenu_page(
        'edit.php?post_type=orders',
        __( 'Books Shortcode Reference', 'textdomain' ), 
        __( 'Shortcode Reference', 'textdomain' ),
        'manage_options', 
        'books-ref-page', 
        'books_ref_page_callback'
    );
} add_action('admin_menu', 'add_custom_option_page');
function books_ref_page_callback() {
     ?>
    <div class="wrap">
        <h1><?php _e( 'Books Shortcode Reference', 'textdomain' ); ?></h1>
        <p><?php _e( 'Helpful stuff here', 'textdomain' ); ?></p>
    </div>
    <?php
}