Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Save new fields for variations */
- function save_variation_fields( $variation_id) {
- $text_field = sanitize_text_field( $_POST['_model_field'][$variation_id] );
- if( ! empty( $text_field ) ) {
- update_post_meta( $variation_id, '_model_field', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = sanitize_text_field( $_POST['_focal_field'][$variation_id] );
- update_post_meta( $variation_id, '_focal_field', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = sanitize_text_field( $_POST['_maximum_aperture'][$variation_id] );
- update_post_meta( $variation_id, '_maximum_aperture', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = sanitize_text_field( $_POST['_coverage'][$variation_id] );
- update_post_meta( $variation_id, '_coverage', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = sanitize_text_field( $_POST['_optical_construction'][$variation_id] );
- update_post_meta( $variation_id, '_optical_construction', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = stripslashes( $_POST['_aperture_range'][$variation_id] );
- update_post_meta( $variation_id, '_aperture_range', esc_attr( $text_field ) );
- }
- $text_field2 = stripslashes( $_POST['_diaphragm_blades'][$variation_id] );
- if( ! empty( $text_field2 ) ) {
- update_post_meta($variation_id, '_maximum_aperture', esc_attr($text_field2));
- }
- $text_field = stripslashes( $_POST['_coating'][$variation_id] );
- if( ! empty( $text_field ) ) {
- update_post_meta( $variation_id, '_coating', esc_attr( $text_field ) );
- }
- $text_field = stripslashes( $_POST['_minimum_fdistance'][$variation_id] );
- if( ! empty( $text_field ) ) {
- update_post_meta( $variation_id, '_minimum_fdistance', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = stripslashes( $_POST['_filter_size'][$variation_id] );
- update_post_meta( $variation_id, '_filter_size', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = stripslashes( $_POST['_lens_hood'][$variation_id] );
- update_post_meta( $variation_id, '_lens_hood', esc_attr( $text_field ) );
- }
- if( ! empty( $text_field ) ) {
- $text_field = stripslashes($_POST['_maximum_diameter'][$variation_id]);
- update_post_meta($variation_id, '_maximum_diameter', esc_attr($text_field));
- }
- $hidden = $_POST['_hidden_field'][$variation_id];
- if( ! empty( $hidden ) ) {
- update_post_meta( $variation_id, '_hidden_field', esc_attr( $hidden ) );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement