在WordPress的后端添加额外的字段类型

时间:2018-10-11 05:44:09

标签: wordpress wordpress-rest-api

read mark places i want to add extra two fields. that is Liked and Unliked 我该怎么办?

我的注册信息类型为:

register_post_type('faq-page',array(

        'labels' => array(

            'name' => 'FAQ',
            'add_new_item' => 'Add New FAQ',
            'add_new' => 'Add New FAQ',
            'all_items' => 'All FAQ',
        ),

        'public' => true,
        'show_in_rest' => true,
        'supports' => array('title','editor'),
        'menu_icon' => 'dashicons-plus',
    ));`

1 个答案:

答案 0 :(得分:0)

您需要使用manage_ [post_type] _posts_columns挂钩。看一下WP文档-https://developer.wordpress.org/reference/hooks/manage_post_type_posts_columns/。还可以看一下本文,在这里您可以找到一个很好的示例,说明如何将此钩子用于自定义帖子类型-https://www.smashingmagazine.com/2017/12/customizing-admin-columns-wordpress/我认为这正是您所需要的。