首先,我是WordPress的新手。我对用于保存和更新表单数据的内部函数了解甚少。我正在使用Yith woo-commerce多供应商高级插件,并希望在供应商条目和更新表单中添加自定义字段。我该怎么办,请帮忙。我在下面尝试过一些代码,但是不知道输入和更新的功能。请帮忙。
$vendor = apply_filters( 'yith_new_vendor_registration_fields', $vendor );
add_action( 'yith_shop_vendor_add_form_fields', 'custom_add_vendor_fields', 2, 1 );
function custom_add_vendor_fields( $taxonomy ) {
?>
<div class="form-field">
<label for="vendor_category"><?php _e( 'Vendor Category' ); ?></label>
<input type="text" name="vendor_data[category]" id="vendor_category" class="vendor_fields" /><br/>
<span class="description"><?php _e( 'The vendor\'s category.' ); ?></span>
</div>
<?php
}
add_action( 'yith_shop_vendor_edit_form_fields', 'custom_edit_vendor_fields', 2, 1 );
function custom_edit_vendor_fields( $vendor ) {
?>
<tr class="form-field">
<th scope="row" valign="top"><label for="vendor_category"><?php _e( 'Vendor category' ); ?></label></th>
<td>
<input type="text" name="vendor_data[category]" id="vendor_category" class="vendor_fields" /><br/>
<span class="description"><?php _e( 'The vendor\'s category' ); ?></span>
</td>
</tr>
<?php
}