Skip to content

Commit

Permalink
move to using wp_remote_get
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoffDusome committed May 24, 2023
1 parent 6e41f47 commit 000a2a1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions block-editor-custom-alignments.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,15 @@ private function block_editor_custom_alignments_theme_json(): object {
return new \stdClass();
}

$theme_json = file_get_contents( trailingslashit( get_stylesheet_directory_uri() ) . 'theme.json' );
$response = wp_remote_get( trailingslashit( get_stylesheet_directory_uri() ) . 'theme.json' );

if ( $theme_json === false ) {
if ( is_wp_error( $response ) ) {
return new \stdClass();
}

$theme_json = wp_remote_retrieve_body( $response );

if ( $theme_json === '' ) {
return new \stdClass();
}

Expand Down

0 comments on commit 000a2a1

Please sign in to comment.