Skip to content

Commit

Permalink
Use sanitize_url to sanitize canonical field in the taxonomy metabox
Browse files Browse the repository at this point in the history
  • Loading branch information
stodorovic committed Jul 11, 2023
1 parent f602e03 commit 8e533df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions admin/taxonomy/class-taxonomy.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,16 @@ public function update_term( $term_id, $tt_id, $taxonomy ) {
foreach ( WPSEO_Taxonomy_Meta::$defaults_per_term as $key => $default ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: Nonce is already checked by WordPress before executing this action.
if ( isset( $_POST[ $key ] ) && is_string( $_POST[ $key ] ) ) {
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- Reason: Nonce is already checked by WordPress before executing this action.
$new_meta_data[ $key ] = sanitize_text_field( wp_unslash( $_POST[ $key ] ) );
// phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: $data is getting sanitized later.
$data = \wp_unslash( $_POST[ $key ] );
$new_meta_data[ $key ] = ( $key !== 'wpseo_canonical' ) ? WPSEO_Utils::sanitize_text_field( $data ) : WPSEO_Utils::sanitize_url( $data );
}

// If analysis is disabled remove that analysis score value from the DB.
if ( $this->is_meta_value_disabled( $key ) ) {
$new_meta_data[ $key ] = '';
}
}
unset( $key, $default );

// Saving the values.
WPSEO_Taxonomy_Meta::set_values( $term_id, $taxonomy, $new_meta_data );
Expand Down

0 comments on commit 8e533df

Please sign in to comment.