在主题中添加额外的注册字段我的插件wordpress

时间:2018-09-21 13:16:11

标签: wordpress wordpress-theming

我正在尝试在登录插件Wordpress的主题中添加一些额外的字段。

我已经完成主题的documentation了。

多余的字段未保存在数据库中。我也在数据库中添加了额外的字段,但仍然没有将数据保存在数据库中

有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您需要使用custom类型而不是textfirst_name

function add_tml_registration_form_fields() {
    tml_add_form_field( 'register', 'custom_1', array(
        'type'     => 'custom',
        'label'    => 'First Name 1 ',
        'value'    => tml_get_request_value( 'first_name_test', 'post' ),
        'id'       => 'first_name_test',
        'priority' => 15,
    ) );
    tml_add_form_field( 'register', 'custom_2', array(
        'type'     => 'custom',
        'label'    => 'Last Name 1',
        'value'    => tml_get_request_value( 'last_name_test', 'post' ),
        'id'       => 'last_name_test',
        'priority' => 15,
    ) );
}
add_action( 'init', 'add_tml_registration_form_fields' );

阅读

https://docs.thememylogin.com/article/104-function-tmladdformfield