I created a custom post type and I hide it
using
register_post_type()
and a menu page using
add_menu_page()
andadd_submenu_page()
the link for the custom post type is page=edit.php?post_type=survey
and for the menu page is admin.php?page=my_survey
I hide the custom post type
because I don't want to show it, I just want to have one menu but with a link to the sub menu page that goes to the custom post type
the problem is that all the links in the menu have the prefix
admin.php?page=
when I add the link in the
menu_slug => 'edit.php?post_type=survey'
it adds
admin.php?page=edit.php?post_type=survey
is it anyway that I can remove that prefix from just one sub menu ?
I'm working on a OOP this is how I add the submenu
public function setSubPages()
{
$this->subpages = [
[
'parent_slug' => 'survey',
'page_title' => 'Survey Plugin',
'menu_title' => 'Survey',
'capability' => 'manage_options',
'menu_slug' => 'edit.php?post_type=survey',
'callback' => [$this->callbacks, 'adminDashboard'],
];
}
and my custom post type
public function activate()
{
$labels = [
'name' => 'survey',
'singular_name' => 'survey',
];
$args = [
'labels' => $labels,
'public' => true,
'has_archive' => false,
'menu_icon' => 'dashicons-email-alt',
'supports' => false,
'exclude_from_search' => true,
'publicly_queryable' => false,
'show_in_menu' => false
];
register_post_type( 'survey', $args );
}
if I wasn't clear enough please let me know thanks