*/ class Simple_Job_Board_Meta_Box_Job_Features { /** * Meta box for Job Features. * * @since 2.2.3 */ public static function sjb_meta_box_output($post) { global $jobfields; // Add a nonce field so we can check for it later. wp_nonce_field('sjb_jobpost_meta_box', 'jobpost_meta_box_nonce'); /* * Use get_post_meta() to retrieve an existing value * from the database and use the value for the form. */ ?>
$val): if ( substr($val, 0, 11) == 'jobfeature_' ) { delete_post_meta($post_id, $val); //Remove meta from the db. } endforeach; $POST_data = filter_input_array( INPUT_POST ); // Add new value. foreach( $POST_data as $key => $val ): if ( substr($key, 0, 11 ) == 'jobfeature_' ) { // Make sure that it is set. $key = preg_replace('/[^\p{L} 0-9]/u', '_', $key); $data = serialize( array_map('sanitize_text_field', filter_input( INPUT_POST, $key, FILTER_DEFAULT, FILTER_REQUIRE_ARRAY ) ) ); update_post_meta( $post_id, $key, $data ); // Add new value. } endforeach; } }