Add Post type menu to another menu

You only need to add the page slug to “show_in_menu”, making the answer to your example: ‘show_in_menu’ => ‘mytestpage’, For a more complete example: Admin/Settings page of: /wp-admin/admin.php?page=mytestpage register_post_type(‘mycpt’, array(‘label’ => ‘My Custom Post Type’, ‘capability_type’ => ‘post’, ‘show_ui’ => true, ‘show_in_menu’ => ‘mytestpage’));

How Do I Programmatically Better Organize Custom Post Type Menus?

On the function to register a new custom post type can you set this CPT as Submenu to a exist menu item. Use the param show_in_menu A example: register_post_type( ‘issue’, apply_filters( ‘wpit_register_issue_post_type’, array( ‘labels’ => $issue_labels, ‘rewrite’ => $issue_rewrite, ‘supports’ => $issue_supports, ‘taxonomies’ => $issue_taxonomies, ‘menu_position’ => 5, ‘public’ => TRUE, ‘show_ui’ => TRUE, ‘show_in_menu’ … Read more

How to check if an admin (sub)menu already exists?

Something like this should work. $handle should be the menu’s slug; set $sub to true to search submenus (defaults to top level menus): function find_my_menu_item( $handle, $sub = false; ){ if( !is_admin() || (defined(‘DOING_AJAX’) && DOING_AJAX) ) return false; global $menu, $submenu; $check_menu = $sub ? $submenu : $menu; if( empty( $check_menu ) ) return … Read more

WordPress Admin Tooltip hooks

Here is the simplest implementation I know of since there is no real API: //add the needed scripts and styles add_action(‘admin_enqueue_scripts’, ‘wpse_46028_enqueue_admin_scripts’); function wpse_46028_enqueue_admin_scripts() { wp_enqueue_style(‘wp-pointer’); wp_enqueue_script(‘wp-pointer’); //hook the pointer add_action(‘admin_print_footer_scripts’, ‘wpse_46028_print_footer_scripts’ ); } function wpse_46028_print_footer_scripts() { $pointer_content=”<h3>WordPress Answers</h3>”; $pointer_content .= ‘<p>This is your pointer content</p>’; ?> <script type=”text/javascript”> //<![CDATA[ jQuery(document).ready( function($) { //jQuery selector … Read more

Delete option doesn’t appear for plugins

D’oh. I fixed it, but I’ll leave this question in case others have similar problems. When copy/pasting various options into wp-config.php I accidentally included this setting, which I don’t normally use: // Overkill but FYI: disallows installation/updating of any theme or plugin define(‘DISALLOW_FILE_MODS’,true); That produces the described problem, albeit by design.

Remove ability to access certain admin menus

I figured it out in the end and this is the code I used: function restrict_menus() { $author = wp_get_current_user(); if( isset( $author->roles[0] ) ) { $current_role = $author->roles[0]; } else { $current_role=”no_role”; } if( ‘contributor’ == $current_role ) { $screen = get_current_screen(); $base = $screen->id; if( ‘edit-post’ == $base || ‘upload’ == $base || … Read more

Reorder custom submenu item

Got it, thanks to cjbj‘s help, I was able to get the final solution: add_filter( ‘custom_menu_order’, ‘submenu_order’ ); function submenu_order( $menu_order ) { # Get submenu key location based on slug global $submenu; $settings = $submenu[‘options-general.php’]; foreach ( $settings as $key => $details ) { if ( $details[2] == ‘blogging’ ) { $index = $key; … Read more

How to remove items from +New admin menu?

To hide everything (menu and submenu)- function wpse_260669_remove_new_content(){ global $wp_admin_bar; $wp_admin_bar->remove_menu( ‘new-content’ ); } add_action( ‘wp_before_admin_bar_render’, ‘wpse_260669_remove_new_content’ ); To hide specific menu/submenu item(s)- function wpse_260669_remove_new_content_items(){ global $wp_admin_bar; $wp_admin_bar->remove_menu( ‘new-post’ ); // hides post CPT $wp_admin_bar->remove_menu( ‘new-product’ ); // hides product CPT $wp_admin_bar->remove_menu( ‘new-page’ ); // hides page CPT $wp_admin_bar->remove_menu( ‘new-media’ ); // hides media } … Read more

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