Skip to content

Commit

Permalink
Fix deprecation warning for htmlspecialchars
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwatkins0 committed Jan 19, 2024
1 parent 18d0938 commit c044382
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wp/headless-wp/includes/classes/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function modify_rest_params( $args, $request ) {
return $args;
}

$author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) );
$author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) ?? '' );

if ( ! empty( $author ) && ! is_numeric( $author ) ) {
unset( $args['author__in'] );
Expand All @@ -108,10 +108,10 @@ public function modify_rest_params( $args, $request ) {
$taxonomies = wp_list_filter( get_object_taxonomies( $args['post_type'], 'objects' ), [ 'show_in_rest' => true ] );

foreach ( $taxonomies as $taxonomy ) {
$term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) );
$term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) ?? '' );

if ( ! $term ) {
$term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) );
$term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) ?? '' );
}

if ( ! empty( $term ) && ! is_numeric( $term ) ) {
Expand Down

0 comments on commit c044382

Please sign in to comment.