Skip to content

Commit

Permalink
Ensure that code_snippets/update_snippet hook receives consistetly ty…
Browse files Browse the repository at this point in the history
…ped data.
  • Loading branch information
sheabunge committed Sep 15, 2023
1 parent 731a9c7 commit 0b58802
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions php/snippet-ops.php
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ function get_snippet_by_cloud_id( $cloud_id, $multisite = null ) {
* @param array<string, mixed> $fields An array of fields mapped to their values.
* @param bool|null $network Update in network-wide (true) or site-wide (false) table.
*/
function update_snippet_fields( $snippet_id, $fields, $network = null ) {
function update_snippet_fields( int $snippet_id, array $fields, $network = null ) {
global $wpdb;

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

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

0 comments on commit 0b58802

Please sign in to comment.