admin管理员组文章数量:1334798
"client" is a custom post type because I have to add several metaboxes. For a better ergonomy on admin side, I would like to add my custom post type "client" as "users" submenu.
I understand to display a custom post type, normally urls are :
- .php?post_type=client
- .php?post_type=client
When I add "client" inside users menu, I got this url :
.php?page=client
So, that does not work.
How can I get the client edition with list/post-new/edit-new based on the last url ?
"client" is a custom post type because I have to add several metaboxes. For a better ergonomy on admin side, I would like to add my custom post type "client" as "users" submenu.
I understand to display a custom post type, normally urls are :
- https://my-site/wp-admin/edit.php?post_type=client
- https://my-site/wp-admin/post-new.php?post_type=client
When I add "client" inside users menu, I got this url :
https://my-site/wp-admin/users.php?page=client
So, that does not work.
How can I get the client edition with list/post-new/edit-new based on the last url ?
Share Improve this question asked Jul 14, 2020 at 20:05 J.BizMaiJ.BizMai 9002 gold badges10 silver badges30 bronze badges1 Answer
Reset to default 0Solution 1 (not a good idea):
add_users_page(
_x( $this->page_title, "page_title", $this->text_domain ),
_x( $this->menu_title, "menu_title", $this->text_domain ),
$this->capability,
"edit.php?post_type=my-post-type"
);
Notice : This code is used in a class.
When you are on the page, it can have some bugs with the menu, it´s a good idea for specific page
Solution 2 :
register_post_type(
'my-post-type',
array(
'show_in_menu' => "users.php"
)
);
本文标签: Is there a way to display a custom post type menu item as quotusersquot submenu
版权声明:本文标题:Is there a way to display a custom post type menu item as "users" submenu? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742262163a2442715.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论