How do I demote a menu item in the admin menu?

Your question is very abstract. It actually vary form plugin to plugin how the organize the menu and pages. So it’s kinda hard to know how the plugin developer has managed the pages in their code. By the way as far I understood, you need to remove the page by using remove_menu_page function. Here is … Read more

rewrite custom post type slug in wp admin

So what I did was: First make a function that would be returning these slugs based on custom post type name, and if the provided custom slug didn’t meet the requirements it falls back to a default value: function my_get_custom_slugs($cpt){ $all_the_slugs = [ “ugly_machine_name_1” => “default-pretty-name-1”, “ugly_machine_name_2” => “default-pretty-name-2”, //…etc ]; $r_val = array(); $options … Read more

How to add_menu_page include a php file page from theme directory

Fifth parameter of add_menu_page is of type callable. So you can’t just give it “test.php” and expect it to load. But you could probably do something like: // Include the fine with some function for example bananaMonday() declared include_once( __DIR__ . ‘/test.php’ ); // And then use it as param for add_menu_page add_menu_page(‘Test’, ‘test’, ‘manage_options’, … Read more

Saving checkbox/option list status?

This is really just an html question, not specific to WordPress. Look into checked=”checked” (for check boxes) or selected=”selected” (for selects, radio buttons, etc.) In your case, <input type=”checkbox” name=”showS” value=”true” <?php if (get_option(‘showS’)==true) echo ‘checked=”checked” ‘; ?>> Since this is WordPress, though, I should also be reminding you to use the Settings API where … Read more

Create a admin page in wordpress without admin menus (“wordpress sidebars”)

You can use the built in ThickBox to display the popup by Ajax: //first add thickbox to your page function add_thickbox(){ if(is_admin() && (isset($_GET[‘page’]) && $_GET[‘page’] == “my-plugin-file.php”) { wp_enqueue_script(‘jquery’); wp_enqueue_script(‘thickbox’,null,array(‘jquery’)); wp_enqueue_style(‘thickbox.css’, “https://wordpress.stackexchange.com/”.WPINC.’/js/thickbox/thickbox.css’, null, ‘1.0’); } } add_action(‘wp_enqueue_script’,’add_thickbox’); //then in your user list for each user you add the thickbox //popup on the onclick and … Read more

Associating custom submenu item with post type of top level menu item

You need the information about the current post type in your callback function that renders the submenu page output. And at this point there is a lot of information ready: add_action( ‘admin_menu’, ‘wpse_60730_demo_submenu’ ); /** * Register sub menu pages. * * Note that get_current_screen() is still NULL now. * * @wp-hook admin_menu * @return … Read more

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