Change order of custom submenu link in WP Admin?

Take a look at this function. function my_submenu_order($menu_ord) { global $submenu; // echo ‘<pre>’.print_r($submenu,true).'</pre>’; $arr = array(); $arr[] = $submenu[‘users.php’][15]; // Your Profile $arr[] = $submenu[‘users.php’][10]; // Add New $arr[] = $submenu[‘users.php’][5]; // All Users $submenu[‘users.php’] = $arr; return $menu_ord; } add_filter(‘custom_menu_order’, ‘my_submenu_order’); Add that to your functions.php. It changes the default order of the … Read more

How is a widget supposed to reference what is added to custom submenu or addmenu fields?

The setting API, which its usage is being demonstrated in that code is meant to be use as a framework to create settings pages which result in update of values in options. Widget settings are is a somewhat more abstract level. They are stored in options, but there is no flexibility how they are stored, … Read more

What’s the correct way of moving a menu page to a submenu

By adding post_type to add_submenu_page menu slug it will active CPT page menu. then you have to add parent page as that CPT to that commnet page by using submenu_file filter. # Move comment to CPT function wpse354847_relocate_comments_in_admin_menu() { // Remove existing parent menu. remove_menu_page( ‘edit-comments.php’ ); // Move Comments under Complaints (‘complaint’). add_submenu_page( ‘edit.php?post_type=complaint’, … Read more

Create dynamic wordrpess blank page

Try something like this: in the load hook, you can ouput your xml code. u function my_menu_pages() { $hook = add_submenu_page( null, ‘Page Title’, ‘Page Title’, ‘administrator’, ‘sub-menu-slug’, function() { } ); add_action(‘load-‘ . $hook, function() { // add your xml code here, // you will get a blank page to start with exit; }); … Read more

Howto check version of another plugin and then add a submenu page to it

Ok i got it. The solution is to use an earlier hook for checking plugins. But then the function get_plugins() is not available so i have to include it for using. The working code: class acf_multisite_sync { function __construct() { add_action(‘plugins_loaded’, array($this, ‘acf_sync_init’)); } function acf_sync_init() { if (!function_exists(‘get_plugins’)) { require_once ABSPATH . ‘wp-admin/includes/plugin.php’; } … Read more

plugin admin subpage title and links in menu not highlited at current page

In the function add_submenu_page() you have to specify a callback function at the end. Like you did it in the 2nd submenu page. You have to add this function to your code! Example: add_submenu_page( ‘my-parent’, ‘Subpage title’, ‘Subpage title’, ‘manage_options’, ‘my_subpage’, ‘subpage-handle’); function subpage-handle() { echo ‘<h1>Subpage title</h1>’; } In this function you can echo … Read more

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