admin管理员组文章数量:1122832
Im using:
// wp-admin hotels list in sidebar
function add_custom_submenu_under_add_new() {
$args=array(
'post_type' => 'hotel',
'posts_per_page' => -1,
'post_parent' => 0
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
global $post;
add_submenu_page(
'edit.php?post_type=hotel', // parent slug
get_the_title($post->ID), // page title
get_the_title($post->ID), // menu title
'edit_posts', // capability (use the same as for editing posts)
'post.php?post='.$post->ID.'&action=edit'
);
}
}
wp_reset_postdata();
}
add_action('admin_menu', 'add_custom_submenu_under_add_new');
To add custom menu to wp-admin sidebar under custom post type (hotel). What I need to do is to add second level menu to every created item, so I can show there subpages of this CPT. Is there any way to achieve that?
本文标签: wp adminaddsubmenupage add multilevel menu
版权声明:本文标题:wp admin - add_submenu_page add multilevel menu 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736309850a1934168.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论