Skip to content

Commit 481245a

Browse files
committed
added JSON type for query preparation
1 parent 924e9ab commit 481245a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Schema/Traits/Custom_Table_Query_Methods.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,10 @@ private static function prepare_value_for_query( string $column, $value ): array
742742
( $value instanceof DateTimeInterface ? $value->format( 'Y-m-d H:i:s' ) : (string) $value );
743743
$placeholder = '%s';
744744
break;
745+
case PHP_Types::JSON:
746+
$value = is_string( $value ) ? $value : wp_json_encode( $value );
747+
$placeholder = '%s';
748+
break;
745749
case PHP_Types::FLOAT:
746750
$value = is_array( $value ) ? array_map( fn( $v ) => (float) $v, $value ) : (float) $value;
747751
$placeholder = '%f';

0 commit comments

Comments
 (0)