wordpress - 无法在 wordpress 上使用具有自定义帖子类型的插件
问题描述
我在 Wordpress 中创建了一些新的自定义帖子类型,但是当我想编辑我的帖子时,我无法使用 yoast SEO 之类的插件(它不会出现在管理员中)。这是我生成自定义帖子类型的功能
public function register_custom_vertical_post_type() {
// Get verticals from form in the admin with metabox
$verticals = rwmb_meta("verticals", ['object_type' => 'setting'], 'manage-vertical');
foreach($verticals as $vertical):
$name = $vertical["name"];
$plural_name = $vertical["plural_name"];
$labels = [
'name' => esc_html__( ucfirst($plural_name), $this->current_theme ),
'singular_name' => esc_html__( "{$name}", $this->current_theme ),
'add_new' => esc_html__( 'Add New', $this->current_theme ),
'add_new_item' => esc_html__( "Add new {$name}", $this->current_theme ),
'edit_item' => esc_html__( "Edit {$name}", $this->current_theme ),
'new_item' => esc_html__( "New {$name}", $this->current_theme ),
'view_item' => esc_html__( "View {$name}", $this->current_theme ),
'view_items' => esc_html__( "View {$plural_name}", $this->current_theme ),
'search_items' => esc_html__( "Search {$plural_name}", $this->current_theme ),
'not_found' => esc_html__( "No {$plural_name} found", $this->current_theme ),
'not_found_in_trash' => esc_html__( "No {$plural_name} found in Trash", $this->current_theme ),
'parent_item_colon' => esc_html__( ucfirst($name) . "" . $name . ":", $this->current_theme ),
'all_items' => esc_html__( "All {$plural_name}", $this->current_theme ),
'archives' => esc_html__( ucfirst($name) . " Archives", $this->current_theme ),
'attributes' => esc_html__( ucfirst($name) . " Attributes", $this->current_theme ),
'insert_into_item' => esc_html__( "Insert into {$name}", $this->current_theme ),
'uploaded_to_this_item' => esc_html__( "Uploaded to this {$name}", $this->current_theme ),
'featured_image' => esc_html__( 'Featured image', $this->current_theme ),
'set_featured_image' => esc_html__( 'Set featured image', $this->current_theme ),
'remove_featured_image' => esc_html__( 'Remove featured image', $this->current_theme ),
'use_featured_image' => esc_html__( 'Use as featured image', $this->current_theme ),
'menu_name' => esc_html__( ucfirst($name), $this->current_theme ),
'filter_items_list' => esc_html__( "Filter {$plural_name} list", $this->current_theme ),
'filter_by_date' => esc_html__( '', $this->current_theme ),
'items_list_navigation' => esc_html__( ucfirst($plural_name). " list navigation", $this->current_theme ),
'items_list' => esc_html__( ucfirst($plural_name). " list", $this->current_theme ),
'item_published' => esc_html__( ucfirst($name). " published", $this->current_theme ),
'item_published_privately' => esc_html__( ucfirst($name). " published privately", $this->current_theme ),
'item_reverted_to_draft' => esc_html__( ucfirst($name). " reverted to draft", $this->current_theme ),
'item_scheduled' => esc_html__( ucfirst($name). " scheduled", $this->current_theme ),
'item_updated' => esc_html__( ucfirst($name). " updated", $this->current_theme ),
'text_domain' => esc_html__( 'pn-origami', $this->current_theme ),
];
$args = [
'label' => esc_html__( ucfirst($plural_name) , ),
'labels' => $labels,
'description' => '',
'public' => true,
'hierarchical' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'show_in_rest' => true,
'query_var' => true,
'can_export' => true,
'delete_with_user' => true,
'has_archive' => false,
'rewrite' => true,
'rest_base' => '',
'show_in_menu' => 'vertical',
'capability_type' => 'page',
'supports' => ['title', 'editor', 'thumbnail', 'author', 'excerpt', 'custom-fields', 'trackbacks', 'revisions', 'comments', 'page-attributes', 'post-formats'],
'taxonomies' => ['category'],
];
register_post_type( $name, $args );
endforeach;
}
我不确定有什么问题以及为什么我不能像普通帖子一样使用任何具有自定义帖子类型的插件。
谢谢
解决方案
推荐阅读
- java - 在 Android Studio 中将 Unity Project (Vuforia) 作为库运行时出错
- postgresql - 无法在没有时区的时间戳的字段上加入没有时区的 generate_series 时间戳
- javascript - 解构导入的 CSS 模块以在组件中使用的便捷方法是什么?
- elasticsearch - 对象或键值对上的弹性搜索聚合
- r - 将数据冲突错误 (409) 转换为客户端可以理解的消息
- linux - 当我尝试仅匹配脚本中的最后一次出现时,Sed 不遵守 $ 地址字符
- google-app-engine - App Engine 对浏览器与邮递员的不同响应
- php - 将对象添加到数组
- swift - 为什么在我更新到 Xcode 11 和 IOS13 后,我的大型 for 循环从几分之一秒变为几乎 8 秒?
- java - 从包含字母和数字的字符串中提取所有数字