ID ); $title = $post_data['title']; $description = $post_data['description']; TemplateRenderer::render( 'admin/metabox', array( 'title' => $title, 'description' => $description, ) ); } /** * Save the metabox settings. * * @param int $post_id Current post ID. */ public function save_meta_box( int $post_id ) { if ( ! current_user_can( 'edit_post', $post_id ) ) { return; } if ( ! isset( $_POST['airygen_metabox_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['airygen_metabox_nonce'] ) ), 'airygen_create_nonce' ) ) { return; } if ( isset( $_POST['airygen_title'] ) ) { $title = trim( sanitize_text_field( wp_unslash( $_POST['airygen_title'] ) ) ); PostData::save_field( $post_id, 'title', $title ); } if ( isset( $_POST['airygen_description'] ) ) { $description = trim( sanitize_text_field( wp_unslash( $_POST['airygen_description'] ) ) ); PostData::save_field( $post_id, 'description', $description ); } } }