Skip to content

Option page as sub-page of another menu broken in 2.8.0 #1410

@JiveDig

Description

@JiveDig

Describe the bug

I have a plugin that uses CMB2 to register an options page as a sub-menu of another custom admin page. This works in 2.7.0 but breaks the url in 2.8.0.

Steps to reproduce (I have confirmed I can reproduce this issue on the develop branch):

The following works with 2.7 producing an admin url with /wp-admin/admin.php?page=some_sub_page

but breaks in 2.8 producing an admin url with /wp-admin/some_sub_page

add_action( 'admin_menu', function() {
	add_menu_page(
		esc_html__( 'Some Page', 'textdomain' ),
		esc_html__( 'Some Page', 'textdomain' ),
		'edit_posts',
		'some-page',
		'prefix_render_admin_menu_page'
	);
});

add_action( 'cmb2_admin_init', function() {
	$cmb = new_cmb2_box( array(
		'id'           => 'some_sub_page_metabox',
		'title'        => __( 'Some Sub-Page', 'textdomain' ),
		'object_types' => array( 'options-page' ),
		'option_key'   => 'some_sub_page',
		'parent_slug'  => 'some-page',
	) );
});

function prefix_render_admin_menu_page() {
	echo '<h1>Some Page</h1>';
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions