Answers for "Settings pages are created like this:"

PHP
0

Settings pages are created like this:

function pw_create_settings_page() {
	global $pw_settings_page;
	$pw_settings_page = add_options_page(__('My Plugin Settings', 'my-domain'), __('Plugin Settings', 'my-domain'), 'manage_options', 'my-page-slug', 'pw_callback_function');
}
add_action('admin_menu', 'pw_create_settings_page');
Posted by: Guest on August-27-2021
0

Settings pages are created like this:

function pw_load_scripts($hook) {
 
	global $pw_settings_page;
 
	if( $hook != $pw_settings_page ) 
		return;
 
	wp_enqueue_script( 'custom-js', plugins_url( 'js/custom.js' , dirname(__FILE__) ) );
}
add_action('admin_enqueue_scripts', 'pw_load_scripts');
Posted by: Guest on August-27-2021

Code answers related to "Settings pages are created like this:"

Browse Popular Code Answers by Language