Skip to content

Commit 0b58802

Browse files
committed
Ensure that code_snippets/update_snippet hook receives consistetly typed data.
1 parent 731a9c7 commit 0b58802

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

php/snippet-ops.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ function get_snippet_by_cloud_id( $cloud_id, $multisite = null ) {
711711
* @param array<string, mixed> $fields An array of fields mapped to their values.
712712
* @param bool|null $network Update in network-wide (true) or site-wide (false) table.
713713
*/
714-
function update_snippet_fields( $snippet_id, $fields, $network = null ) {
714+
function update_snippet_fields( int $snippet_id, array $fields, $network = null ) {
715715
global $wpdb;
716716

717717
$table = code_snippets()->db->get_table_name( $network );
@@ -733,6 +733,6 @@ function update_snippet_fields( $snippet_id, $fields, $network = null ) {
733733
// Update the snippet in the database.
734734
$wpdb->update( $table, $clean_fields, array( 'id' => $snippet->id ), null, array( '%d' ) );
735735

736-
do_action( 'code_snippets/update_snippet', $snippet->id, $table );
736+
do_action( 'code_snippets/update_snippet', $snippet, $table );
737737
clean_snippets_cache( $table );
738738
}

0 commit comments

Comments
 (0)