如何从自定义 Post 类型的 post 中隐藏永久链接部分?

How to hide Permalink section from a Custom Post Type's post?

我想在 Wordpress 中的特定 post 类型的 post 标题下隐藏固定链接部分。我该怎么做?

register_post_types 下添加以下参数:

'public' => false,  // it's not public, it shouldn't have it's own permalink, and so on
'publicly_queryable' => true,  // you should be able to query it
'show_ui' => true,  // you should be able to edit it in wp-admin
'exclude_from_search' => true,  // you should exclude it from search results
'show_in_nav_menus' => false,  // you shouldn't be able to add it to menus
'has_archive' => false,  // it shouldn't have archive page
'rewrite' => false,  // it shouldn't have rewrite rules

你需要的是第一个元素'public' => false

我们找不到这样的过滤器或选项来删除 "slug" 如 "title" "content editor" 等

我们需要通过 CSS 来管理它。通过研究 Advance Custom Fields (ACF),他们做了同样的事情。 他们将 display:none 放在代码中。

您只需将下面的代码放入 style.css:

.post-type-<post type slug> #edit-slug-box {
display: none;
}