【问题标题】:How to Hook into WordPress Custom Post Type Dashboard menu items如何挂钩到 WordPress 自定义帖子类型仪表板菜单项
【发布时间】:2013-12-10 19:37:42
【问题描述】:

我正在开发一个将使用自定义帖子类型的 WordPress 插件。

我使用 register_post_type('wpbp-backgrounds', $args); 和所需的参数以标准 WP 方式创建了 Post 类型。

以这种方式创建帖子会创建访问新自定义帖子所需的 WP 仪表板菜单项。

我的新菜单是:

  • WP 背景
    • 背景
    • 添加新背景

我想做的是连接到这个仪表板菜单并添加第三个项目,我可以链接到插件设置页面。菜单如下所示:

  • WP 背景
    • 背景
    • 添加新背景
    • 设置

这是可能的吗?任何帮助将不胜感激。

【问题讨论】:

    标签: php wordpress menu custom-post-type dashboard


    【解决方案1】:

    使用add_submenu_page(),您可以使用'edit.php?post_type=wpbp-backgrounds' 为您的$parent_slug 参数添加子菜单到您的CPT 菜单。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-30
      • 1970-01-01
      • 2015-07-22
      • 2015-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-13
      相关资源
      最近更新 更多