【发布时间】:2019-10-22 18:35:00
【问题描述】:
我试图让客户在他们的 WordPress 帐户页面上更改他们的角色,并且除了前端显示的内容之外,所有功能都运行良好。当他们来改变他们的角色时,选择的选项总是“选择一个选项...”而不是他们被指定的实际角色(例如示例 1)。我已经排除了一些角色(例如管理员),因为我只想向他们展示某些角色。我在下面的代码中做了什么改变来解决这个问题并显示他们当前的角色?
function iconic_get_account_fields() {
return apply_filters( 'iconic_account_fields', array(
'first_name' => array(
'type' => 'text',
'label' => __( 'First Name', 'iconic' ),
'hide_in_account' => true,
'hide_in_admin' => true,
'hide_in_checkout' => true,
'hide_in_registration' => false,
'required' => true,
),
'last_name' => array(
'type' => 'text',
'label' => __( 'Last Name', 'iconic' ),
'hide_in_account' => true,
'hide_in_admin' => true,
'hide_in_checkout' => true,
'hide_in_registration' => false,
'required' => true,
),
'role' => array(
'type' => 'select',
'label' => __( 'Franking Machine Model', 'iconic' ),
'hide_in_account' => false,
'hide_in_admin' => true,
'hide_in_registration' => true,
'hide_in_checkout' => true,
'options' => array(
'' => __( 'Select an option...', 'iconic' ),
'example_1_customer' => __( 'Example 1', 'iconic' ),
'example_2_customer' => __( 'Example 2', 'iconic' ),
'example_3_customer' => __( 'Example 3', 'iconic' ),
'other_customer' => __( 'Other', 'iconic' ),
),
),
) );
}
【问题讨论】:
标签: wordpress