Skip to content

Commit 1035106

Browse files
committed
#228 html validation bug fix
1 parent 7b4f731 commit 1035106

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/php/snippet-ops.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,12 @@ function activate_snippet( int $id, ?bool $network = null ) {
295295
// translators: %d: snippet identifier.
296296
return sprintf( __( 'Could not locate snippet with ID %d.', 'code-snippets' ), $id );
297297
}
298-
299-
$validator = new Validator( $snippet->code );
300-
if ( $validator->validate() ) {
301-
return __( 'Could not activate snippet: code did not pass validation.', 'code-snippets' );
298+
299+
if('php' == $snippet->type ){
300+
$validator = new Validator( $snippet->code );
301+
if ( $validator->validate() ) {
302+
return __( 'Could not activate snippet: code did not pass validation.', 'code-snippets' );
303+
}
302304
}
303305

304306
$result = $wpdb->update(

0 commit comments

Comments
 (0)