Title: Custom Post Type Parents
Author: Mickey Kay
Published: <strong>2015 年 2 月 3 日</strong>
Last modified: 2026 年 3 月 10 日

---

搜索插件

![](https://s.w.org/plugins/geopattern-icon/custom-post-type-parents.svg)

# Custom Post Type Parents

 作者：[Mickey Kay](https://profiles.wordpress.org/mcguive7/)

[下载](https://downloads.wordpress.org/plugin/custom-post-type-parents.1.1.3.zip)

 * [详情](https://cn.wordpress.org/plugins/custom-post-type-parents/#description)
 * [评价](https://cn.wordpress.org/plugins/custom-post-type-parents/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/custom-post-type-parents/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/custom-post-type-parents/#developers)

 [支持](https://wordpress.org/support/plugin/custom-post-type-parents/)

## 描述

**Compatible with PHP 8.2**

**Like this plugin? Please consider [leaving a 5-star review](https://wordpress.org/support/view/plugin-reviews/custom-post-type-parents).**

This plugin is meant to solve the problem of highlighting “parent” pages for Custom
Post Types in the menu and lists of pages. It integrates with custom menu output
as well as output for any functions like `wp_list_pages()` that utilize the `page_css_class`
or `nav_menu_css_class` filters. When viewing a custom post type, the assigned “
parent page” will be indicated with standard WordPress classes (e.g. current_page_item)
in navigation menus and lists of pages.

#### Usage

 1. In the admin, navigate to **Settings > Custom Post Type Parents**
 2. For each custom post type, use the dropdown to select a “parent page”

Menus and lists of pages will now have the appropriate classes applied to the specified
parent pages. Additionally, Custom Post Type Parents will apply these classes to
[Simple Section Navigation](https://wordpress.org/plugins/simple-section-navigation/)
widgets, if the plugin is installed.

#### Classes

Custom Post Type Parents applies the following classes to parent and ancestor pages(
all classes are consistent with default WordPress classes and are backwards compatible).

**Parent**
 * current-menu-parent * current_page_parent * current-custom-post-type-
parent * current-{post type}-parent

**Ancestor**
 * current-menu-ancestor * current_page_ancestor * current-custom-post-
type-ancestor * current-{post type}-ancestor

## 屏幕截图

[[

[[

## 安装

#### Manual Installation

 1. Upload the entire `/custom-post-type-parents` directory to the `/wp-content/plugins/`
    directory.
 2. Activate Custom Post Type Parents through the ‘Plugins’ menu in WordPress.

## 常见问题

### How can I report security bugs?

You can report security bugs through the Patchstack Vulnerability Disclosure Program.
The Patchstack team help validate, triage and handle any security vulnerabilities.
[Report a security vulnerability.](https://patchstack.com/database/vdp/custom-post-type-parents)

## 评价

![](https://secure.gravatar.com/avatar/8376f49ee65ef97ac2a9dea7f0952cdaf0189c07a7603122c433a29b94853cdc?
s=60&d=retro&r=g)

### 󠀁[Not working](https://wordpress.org/support/topic/not-working-3601/)󠁿

 [pinguluk](https://profiles.wordpress.org/pinguluk/) 2021 年 4 月 23 日

It looks like this is the perfect match for my issue but it’s not working. Using
WP 5.7 and Custom Post Type UI 1.9.0

![](https://secure.gravatar.com/avatar/733ffb1d8d0a04e421430868edbf398dc3c20685777a70b2ad4242a5952bbdd4?
s=60&d=retro&r=g)

### 󠀁[Does what it claims](https://wordpress.org/support/topic/does-what-it-claims-23/)󠁿

 [chrislhow](https://profiles.wordpress.org/chrislhow/) 2021 年 3 月 30 日

Does exactly what it claims to do. Very useful!

![](https://secure.gravatar.com/avatar/9827e055c6cf4b65976d65c53c4f3ea0c0aa7fd38549ed412dede701c0c52d65?
s=60&d=retro&r=g)

### 󠀁[No longer working on WP 5.0.3](https://wordpress.org/support/topic/no-longer-working-on-wp-5-0-3/)󠁿

 [ryan232](https://profiles.wordpress.org/ryan232/) 2019 年 2 月 1 日

This appears to be exactly what I’m looking for, but it doesn’t appear to be working
for me at this time.

![](https://secure.gravatar.com/avatar/13fd01f51806b002cf97f03bd5c2020fb47fabc223eed314fa05079287a82f14?
s=60&d=retro&r=g)

### 󠀁[Loooooove this plugin!](https://wordpress.org/support/topic/loooooove-this-plugin/)󠁿

 [Andrew](https://profiles.wordpress.org/andrewjohnstrong/) 2018 年 7 月 21 日

This issue (no way to set a parent to a custom post type) had been driving me crazy
for ages until now! Thanks guys 🙂

![](https://secure.gravatar.com/avatar/efa17ac72e4a810ca68ba8e5542bc60647986fdb710503200f3126d58ee9f3dc?
s=60&d=retro&r=g)

### 󠀁[Life saver](https://wordpress.org/support/topic/life-saver-170/)󠁿

 [ikenfin](https://profiles.wordpress.org/ikenfin/) 2017 年 7 月 6 日 2 回复

Just what i need! My case: Modified breadcrumbs based on Really Simple Breadcrumbs
plugin. Have page – shops, where i have pods widget with list of CPT(shops). With
this plugin i finally make breadcrumbs structure correctly, without (very) dirty
hacks, just set parent page “shops” to pods post type, and modified breadcrumbs 
code. Thanks!

 [ 阅读所有6条评价 ](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/)

## 贡献者及开发者

「Custom Post Type Parents」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Mickey Kay ](https://profiles.wordpress.org/mcguive7/)
 *   [ MIGHTYminnow ](https://profiles.wordpress.org/mightyminnow/)

[帮助将「Custom Post Type Parents」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/custom-post-type-parents)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/custom-post-type-parents/)，
查看[SVN仓库](https://plugins.svn.wordpress.org/custom-post-type-parents/)，或通过
[RSS](https://plugins.trac.wordpress.org/log/custom-post-type-parents/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/custom-post-type-parents/)。

## 更新日志

#### 1.1.3

 * Change CSS classname (from custom- to current-) to match documentation and keep
   the same format for all classes.

#### 1.1.2

 * Fix: memory issue infinitely calling constructor.

#### 1.1.1

 * Fix: widget constructor call throwing deprecated notice.

#### 1.1.0

 * Include posts and pages in customizeable list.
 * Update parent select to show hierarchy indenting for easier use.

#### 1.0.1

 * Fix issue in which custom post types weren’t appearing – code was incorrectly
   referencing `slug`
 * Add admin text to indicate if no custom post types are available to edit

#### 1.0.0

 * First release

## 额外信息

 *  版本 **1.1.3**
 *  最后更新：**3 月前**
 *  活跃安装数量 **900+**
 *  WordPress 版本 ** 3.5 或更高版本 **
 *  已测试的最高版本为 **6.9.4**
 *  语言
 * [English (US)](https://wordpress.org/plugins/custom-post-type-parents/)
 * 标签
 * [custom](https://cn.wordpress.org/plugins/tags/custom/)[menu](https://cn.wordpress.org/plugins/tags/menu/)
   [Parent](https://cn.wordpress.org/plugins/tags/parent/)[post](https://cn.wordpress.org/plugins/tags/post/)
   [type](https://cn.wordpress.org/plugins/tags/type/)
 *  [高级视图](https://cn.wordpress.org/plugins/custom-post-type-parents/advanced/)

## 评级

 4 星（最高 5 星）。

 *  [  4 条 5 星评价     ](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/?filter=4)
 *  [  1 条 3 星评价     ](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/?filter=2)
 *  [  1 条 1 星评价     ](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/custom-post-type-parents/reviews/)

## 贡献者

 *   [ Mickey Kay ](https://profiles.wordpress.org/mcguive7/)
 *   [ MIGHTYminnow ](https://profiles.wordpress.org/mightyminnow/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/custom-post-type-parents/)

## 捐助

您愿意支持这个插件的发展吗?

 [ 捐助此插件 ](http://wordpress.org/plugins/custom-post-type-parents)