Skip to content

Commit

Permalink
check for enum
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Oct 10, 2024
1 parent d2d6b0e commit 739fcdf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ public static function register_postmeta() {
'show_in_rest' => true,
'single' => true,
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'sanitize_callback' => function ( $visibility ) {
$options = array(
ACTIVITYPUB_POST_VISIBILITY_PUBLIC,
ACTIVITYPUB_POST_VISIBILITY_QUIET_PUBLIC,
ACTIVITYPUB_POST_VISIBILITY_LOCAL,
);

if ( in_array( $visibility, $options, true ) ) {
return $visibility;
}

return ACTIVITYPUB_POST_VISIBILITY_PUBLIC;
},
)
);
}
Expand Down

0 comments on commit 739fcdf

Please sign in to comment.