Insert link in sub menu – Admin panel

You can try this. add_action( ‘admin_menu’, ‘register_my_custom_menu_page’ ); function register_my_custom_menu_page() { add_menu_page( ‘My Custom Page’, ‘My Custom Page’, ‘manage_options’, ‘my-top-level-slug’, ”, ‘dashicons-menu’, 6 ); add_submenu_page( ‘my-top-level-slug’, ‘My Custom Page’, ‘My Custom Page’, ‘manage_options’, ‘my-top-level-slug’, ‘custom_subpage_first’); add_submenu_page( ‘my-top-level-slug’, ‘My Custom Submenu Page 1’, ‘My Custom Submenu Page’,’manage_options’, ‘my-secondary-slug’, ‘custom_subpage_second’); } function custom_subpage_first() { ?> <div class=”wrap”> … Read more

restrict admin panel sections to users

Add the following, to functions.php of the current theme (child theme is preferred!): CSS solution: function no_email_changes_in_profile() { $screen = get_current_screen(); if (‘profile’ == $screen->base && !current_user_can(‘manage_options’)) { echo ‘<style> input#email { pointer-events: none; } </style>’; } } add_action(‘admin_head’, ‘no_email_changes_in_profile’); jQuery solution: function no_email_changes_in_profile() { $screen = get_current_screen(); if (‘profile’ == $screen->base && !current_user_can(‘manage_options’)) { … Read more

Appearance -> Menus doesn’t show

Please add following code into your theme functions.php file function pietergoosen_theme_setup() { register_nav_menus( array( ‘header’ => ‘Header menu’, ‘footer’ => ‘Footer menu’ ) ); } add_action( ‘after_setup_theme’, ‘pietergoosen_theme_setup’ ); Please check at your end and let me know if any query. Hope it will help you.

require/include php file in add_menu()

You can turn on output buffering, include (and evaluate) the PHP file, and save the output (of the evaluated code) in a variable, like so: ob_start(); include ‘docs/row_layouts.php’; $html = ob_get_clean(); Then just use ‘html’ => $html in the meta array when you call the $admin_bar->add_menu(). Or if you don’t need to evaluate any PHP … Read more

Admin menu hilighting wrong item for CPT

Check: add_submenu_page( ‘edit.php?post_type=landingpage’, ‘Form Settings’, ‘Form Settings’, ‘manage_options’, // This is the menu slug, you can not pass the arguments, // if you want to pass arguments then add only one sub menu page and // links with arguments, also display content with conditions of passed arguments. ‘wp_cpt_plugin_page-form-settings’, ‘my_callback’ );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)