You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the context is in the default contexts, we want to query for all of them.
86
+
// This ensures that a media uploaded with a previous default context will still be found, even if the default context has changed since it was uploaded.
$sql = $wpdb->prepare( "SELECT * FROM {$table_name} WHERE post_id = %d AND media_context = %s", $this->post_id, $this->context ); // phpcs:ignore WordPress.DB
92
+
// Prepare arguments for the SQL query.
93
+
$query_args = array_merge(
94
+
array( $this->post_id ),
95
+
$contexts,
96
+
array( $this->context )
97
+
);
98
+
99
+
// phpcs:ignore WordPress.DB
100
+
$sql = $wpdb->prepare(
101
+
"SELECT * FROM {$table_name} WHERE `post_id` = %d AND `media_context` IN ({$context_query}) ORDER BY FIELD(`media_context`, %s) DESC LIMIT 1", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.PreparedSQL.NotPrepared
0 commit comments