ID, '_repo_daily_author', true ) ?: self::DEFAULT_AUTHOR // phpcs:ignore Universal.Operators.DisallowShortTernary.Found ); $requires_review = get_post_meta( $post->ID, '_repo_daily_clinical_review_required', true ); echo ''; // Author field. printf( '', esc_html__( 'Author / Byline', 'peptide-repo-core' ), esc_attr( $author ) ); // Clinical review flag. printf( '', esc_html__( 'Clinical Review Required', 'peptide-repo-core' ), checked( $requires_review, '1', false ), esc_html__( 'Flag for PR Clinical Review before publish', 'peptide-repo-core' ) ); echo '
%s
'; } /** * Save repo_daily meta fields on post save. * * Side effects: updates post meta. * * @param int $post_id Post ID. * @param \WP_Post $post Post object. * @return void */ public function save_meta( int $post_id, \WP_Post $post ): void { if ( ! isset( $_POST['pr_core_repo_daily_nonce'] ) ) { return; } if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['pr_core_repo_daily_nonce'] ) ), 'pr_core_repo_daily_meta' ) ) { return; } if ( ! current_user_can( 'edit_posts' ) ) { return; } if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Save author field. if ( isset( $_POST['pr_core_repo_daily_author'] ) ) { $author = sanitize_text_field( wp_unslash( $_POST['pr_core_repo_daily_author'] ) ); // Use default if empty. if ( empty( $author ) ) { $author = self::DEFAULT_AUTHOR; } update_post_meta( $post_id, '_repo_daily_author', $author ); } // Save clinical review flag. $requires_review = isset( $_POST['pr_core_repo_daily_clinical_review_required'] ) ? '1' : ''; update_post_meta( $post_id, '_repo_daily_clinical_review_required', $requires_review ); } }