esc_url_raw( rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ), ] ); } /** * Read & parse a JSON file. * * @param string $path The path to the JSON file to load. * @return array The parsed JSON data object. */ function read_json( string $path ) : array { if ( ! file_exists( $path ) ) { return []; } $contents = file_get_contents( $path ); if ( empty( $contents ) ) { return []; } return json_decode( $contents, true ); }