Skip to content

Commit

Permalink
see #1704: updated code
Browse files Browse the repository at this point in the history
  • Loading branch information
mykytadudariev committed Aug 29, 2023
1 parent 41eaa7d commit 5a36112
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,21 +104,24 @@ public function set_about_jsonld( $content_id, $value ) {
* as `null` if we directly pass it to the prepare function(). So its necessary
* to make the query conditional based on the $value
*/
$query = "UPDATE {$wpdb->prefix}wl_entities SET ";
$query .= ( is_null( $value ) ) ? "about_jsonld = NULL, " : "about_jsonld = %s, ";
$query .= ( is_null( $match_name ) ) ? "match_name = NULL " : "match_name = %s ";
$query .= "WHERE content_id = %d AND content_type = %d";

$query = "UPDATE {$wpdb->prefix}wl_entities SET ";
$params = array();

if ( ! is_null( $value ) ) {
if ( is_null( $value ) ) {
$query .= "about_jsonld = NULL, ";
} else {
$query .= "about_jsonld = %s, ";
$params[] = $value;
}

if ( ! is_null( $match_name ) ) {
if ( is_null( $match_name ) ) {
$query .= "match_name = NULL ";
} else {
$query .= "match_name = %s ";
$params[] = $match_name;
}

$query .= "WHERE content_id = %d AND content_type = %d";
$params[] = $content_id->get_id();
$params[] = $content_id->get_type();

Expand Down

0 comments on commit 5a36112

Please sign in to comment.