I have the following options page.
function noknok_wmp_add_options_page() {
acf_add_options_page( [
'page_title' => __( 'NOKNOK Woocommerce Marketing Platform Settings', NOKNOK_WMP_TEXT_DOMAIN ),
'menu_title' => __( 'NOKNOK WMP', NOKNOK_WMP_TEXT_DOMAIN ),
'update_button' => __( 'Save & Sync', NOKNOK_WMP_TEXT_DOMAIN ),
'menu_slug' => 'noknok-wmp-settings',
'redirect' => false,
'capability' => 'edit_posts',
'position' => '3',
'icon_url' => NOKNOK_WMP_URL . '/assets/image/icon.png'
] );
}
add_action( 'acf/init', 'noknok_wmp_add_options_page' );
And the following custom post type which I wish to be a sub-menu item of this navigation.
register_post_type( self::ROLE_PROFILE_POST_TYPE, [
'labels' => $labels = array_merge(
noknok_wmp_post_type_labels( 'Mailerlite Role Sync Profile', 'Mailerlite Role Sync Profiles' ), [
'menu_name' => 'Role Profiles',
'menu_admin_bar' => 'Role Profiles',
'all_items' => 'Role Profiles'
]
),
'description' => "Adds support for Customer Surveys that can be embedded on pages using shortcodes",
'public' => false,
'hierarchical' => true,
'exclude_from_search' => true,
'publicly_queryable' => false,
'show_ui' => true,
'show_in_menu' => 'noknok-wmp-settings',
"show_in_nav_menus" => false,
'show_in_admin_bar' => false,
'capability_type' => 'page',
'supports' => false
] );
This results in the following menu structure
NOKNOK WMP -> edit.php?post_type=ml_role_profile
– Role Profiles -> edit.php?post_type=ml_role_profile
When the post type is not a sub menu item the top level navigation URL works fine although for some strange reason the moment I add a child menu of a post type it no longer functions correctly. Any help appreciated