/** * Save post metadata when a post of {@see $this->post_type} is saved. * * @param int $post_id The ID of the post. * @param WP_Post $post Post object * * @return void|bool */ public function save_meta_boxes($post_id, $post) { if ($this->post_type !== $post->post_type) { return; } // If something wrong with nonce if (!array_key_exists($this->nonce_field, $_POST) || !wp_verify_nonce($_POST[$this->nonce_field], $this->nonce)) { return; } if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!current_user_can('edit_post', $post_id)) { return; } // Save subtitle $meta_box_value = sanitize_text_field($_POST[$this->mb_subtitle_name]); update_post_meta($post_id, $this->mb_subtitle_name, $meta_box_value); unset($meta_box_value); // Save socials $meta_box_value = Appica_Helpers::process_social_networks($_POST[$this->mb_social_name]); update_post_meta($post_id, $this->mb_social_name, $meta_box_value); unset($meta_box_value); }