• i made plugin where i had used “register_post_type” to create custom post taxonomy.

    problem i that my first sub menu is also name of my plugin how can i fix it

    Below i code
    add_action( ‘init’, ‘myofferlugin’ );

    function myofferlugin() {
    
        $labels = array(
            'name' => _x( 'My Plugin', 'offer' ),
            'singular_name' => _x( 'Meno one', 'offer' ),
            'add_new' => _x( 'Add New', 'offer' ),
            'menu_name' => _x( 'My Plugin', 'offer' ),
        );
    
        $args = array(
            'labels' => $labels,
            'hierarchical' => false,
            'supports' => array( 'title' ),
            'menu_icon' => plugins_url('images',  __FILE__).'/icon.png',
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'show_in_nav_menus' => true,
            'publicly_queryable' => true,
            'exclude_from_search' => false,
            'has_archive' => true,
            'query_var' => true,
            'can_export' => true,
            'rewrite' => true,
            'capability_type' => 'post'
        );
    
        register_post_type( 'offer', $args );
    }
  • The topic ‘plugin first menu name different from first submenu using register_post_type’ is closed to new replies.