Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't attach submenu to a top level menu #77

Open
shaonsina opened this issue Jan 24, 2021 · 1 comment
Open

Can't attach submenu to a top level menu #77

shaonsina opened this issue Jan 24, 2021 · 1 comment

Comments

@shaonsina
Copy link

shaonsina commented Jan 24, 2021

I've created a top level menu for my specific need.
After that I would like to create a submenu and attach it to the top level menu by Carbon Fields and creating the options for the page.
But it noting working.

see the below code:

	function add_menu() {
		add_menu_page(
			esc_html__('Configuration', 'test'),
			esc_html__('TEST', 'test'),
			'manage_options',
			'test-configure',
			'configure_page',
			'dashicons-admin-generic',
			'50'
		);
	}
	add_action( 'admin_menu', 'add_menu' );

	Container::make( 'theme_options', esc_html__( 'Settings', 'test' ) )
		->set_page_menu_title( 'Settings' )
		->set_page_parent( 'test-configure' )
		->set_page_file( 'admin.php?page=test-settings' )
		->add_fields( [
			Field::make ...
		] );
@faustort
Copy link

faustort commented Feb 3, 2022

Just a tip, have you tried:
[...]

		->set_page_parent( 'admin.php' )
		->set_page_file( 'test-configure' )

[...]

I've done a test here, and it worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants