esc_html__( 'Default', 'alpert' ), 'disabled' => esc_html__( 'Disabled', 'alpert' ), 'post-thumbnail' => esc_html__( 'Post Thumbnail (470x470)', 'alpert' ), 'alpert-slider' => esc_html__( 'Slider Image (1920x954)', 'alpert' ), 'full' => esc_html__( 'Original Image Size', 'alpert' ), ); $meta_option = get_post_meta( $post->ID, 'alpert-featured-image', true ); if ( empty( $meta_option ) ){ $meta_option = 'default'; } ?> cap->edit_post, $post_id ) ) ) // Check permission { return $post_id; } $fields = array( 'alpert-featured-image', ); foreach ( $fields as $field ) { $new = $_POST[ $field ]; delete_post_meta( $post_id, $field ); if ( '' == $new || array() == $new ) { return; } else { if ( ! update_post_meta ( $post_id, $field, sanitize_text_field( sanitize_key( $new ) ) ) ) { add_post_meta( $post_id, $field, sanitize_text_field( sanitize_key( $new ) ), true ); } } } // end foreach } add_action( 'save_post', 'alpert_save_meta_box' );