How do I code access to the built-in UI of a CPT when it’s placed as submenu of another CPT that is protected by role?

From the codex The function which is hooked in to handle the output of the page must check that the user has the required ‘capability’ as well. What it fails to mention is that the check for subpages iterates upwards to its parent. If a user is not capable of accessing TEACHERS, it will not … Read more

WordPress admin menu formatting issue

Otto has suggested a fix in Chrome itself until the bug is resolved: Go to chrome://flags/#disable-slimming-paint Enable the “Disable slimming paint” option. Ensure that the “Enable slimming paint” option below it is not turned on. Relaunch Chrome. If you don’t want to take this approach you can fix this with CSS: function chromefix_inline_css() { wp_add_inline_style( … Read more

Re-ordering Admin Submenu Sections

Yes there is, but I cannot find a simpler way… Here, we are changing the Media submenu and inverting Add new and Library. add_filter( ‘custom_menu_order’, ‘wpse_73006_submenu_order’ ); function wpse_73006_submenu_order( $menu_ord ) { global $submenu; // Enable the next line to inspect the $submenu values // echo ‘<pre>’.print_r($submenu,true).'</pre>’; $arr = array(); $arr[] = $submenu[‘upload.php’][10]; $arr[] = … Read more

Reorder plugin items in the admin menu

Try taking just the name from the page admin link and see if it works. Something like this: function custom_menu_order($menu_ord) { if (!$menu_ord) return true; return array( ‘index.php’, // Dashboard ‘separator1’, // First separator ‘edit.php’, // Posts ‘pluginname2’, // Take the name from the page menu admin.php?page=pluginname2 ‘upload.php’, // Media ‘edit.php?post_type=page’, // Pages ‘edit-comments.php’, // … Read more

Add custom admin menu item for pages using a certain template

If this is what you want: … you can do it like so: Step #1: Add the custom menu item (Retailer Sendout). function add_retailer_sendout_admin_menu() { $slug = ‘edit.php?post_type=page&template=page-retailer-sendout.php’; add_menu_page( ‘Retailer Sendout’, ‘Retailer Sendout’, ‘edit_pages’, $slug, ”, ‘dashicons-admin-page’, 19 ); } add_action( ‘admin_menu’, ‘add_retailer_sendout_admin_menu’ ); Notes: I’m using add_menu_page() to add the menu (which is a … Read more

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