比方说在设置产品需要关联对应的视频的时候, 文章需要关联对应的产品的时候,特别有用,非常好用:
Field::make( 'association', 'crb_association' )
->set_types( array(
array(
'type' => 'post',
'post_type' => 'page',
),
array(
'type' => 'post',
'post_type' => 'post',
),
array(
'type' => 'term',
'taxonomy' => 'category',
),
array(
'type' => 'term',
'taxonomy' => 'post_tag',
),
array(
'type' => 'user',
),
array(
'type' => 'comment',
),
) )
官方介绍地址:https://docs.carbonfields.net/learn/fields/association.html#example
WP开发教程 WordPress导师在线教程