Php WordPress自定义元数据插件重新排序字段
我正在使用WordPress向我正在工作的站点添加元数据组 我想做的是添加一个自定义字段,可以根据需要添加更多自定义字段,如下所示: 但当我发布帖子时,输入顺序会被打乱,如下所示: 这是我的密码。正在使用Php WordPress自定义元数据插件重新排序字段,php,wordpress,plugins,metadata,field,Php,Wordpress,Plugins,Metadata,Field,我正在使用WordPress向我正在工作的站点添加元数据组 我想做的是添加一个自定义字段,可以根据需要添加更多自定义字段,如下所示: 但当我发布帖子时,输入顺序会被打乱,如下所示: 这是我的密码。正在使用multiple=>true在x\u add\u metadata\u field函数的底部创建多个字段 function myfunction_x_init_cw_fields(){ if( function_exists( 'x_add_metadata_field' ) &&
multiple=>true
在x\u add\u metadata\u field
函数的底部创建多个字段
function myfunction_x_init_cw_fields(){
if( function_exists( 'x_add_metadata_field' ) && function_exists( 'x_add_metadata_group' ) ) {
$post_types = array( 'page' );
$args = array(
'label' => 'Include Content Widgets', // Label for the group
'context' => 'normal', // (post only)
'priority' => 'default', // (post only)
'autosave' => false //, // (post only) Should the group be saved in autosave? NOT IMPLEMENTED YET!
//'exclude' => '', // posts#s to exclude
//'include' => '', // posts#s to include
);
x_add_metadata_group( 'myfunction_cw_details', $post_types, $args );
x_add_metadata_field( 'myfunction_page_cw_field', $post_types, array(
'group' => 'myfunction_cw_details', // the group name
'description' => esc_html('Enter content widget slug under "content widgets"'),
'label' => 'Content Widget Slugs',
'multiple' => true
));
}
}
add_action( 'custom_metadata_manager_init_metadata', 'myfunction_x_init_cw_fields' );
基本上,我希望有人会说“嘿,有一个设置可以排序文档中没有提到的结果。”您是否尝试过将这些添加到args中:
'orderby' => 'meta_value',
'order' => 'ASC'
例如
x_add_metadata_field( 'myfunction_page_cw_field', $post_types, array(
'group' => 'myfunction_cw_details', // the group name
'description' => esc_html('Enter content widget slug under "content widgets"'),
'label' => 'Content Widget Slugs',
'multiple' => true,
'orderby' => 'meta_value',
'order' => 'ASC'
));