-
-
Notifications
You must be signed in to change notification settings - Fork 519
Ignoring code which flags errors
Md Rayhan Uddin edited this page Apr 27, 2026
·
3 revisions
foreach ( $add as $col => $def ) {
if ( ! in_array( $col, (array) $cols, true ) ) {
// One-time schema migration — ALTER TABLE is intentional.
// $col is an allowlisted key from our own $add array (never user input).
// $def is a hardcoded string literal (never user input).
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange
$wpdb->query(
$wpdb->prepare(
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
'ALTER TABLE %i ADD COLUMN ' . $col . ' ' . $def,
$table
)
);
}
}