Can you provide a screenshot of what your snippet looks like, or at least the code so I can test it out myself?
Hello this is the code:
function get_sheet_value_prezzi($atts) {
$API = 'API-SERIAL';
$google_spreadsheet_ID = 'GOOGLE-DOC-ID';
$api_key = esc_attr( $API);
$location = $atts['location'];
$get_cell = new WP_Http();
$cell_url = "https://sheets.googleapis.com/v4/spreadsheets/$google_spreadsheet_ID/values/$location?&key=$api_key";
$cell_response = $get_cell -> get( $cell_url);
$json_body = json_decode($cell_response['body'],true);
$cell_value = $json_body['values'][0][0];
return $cell_value;
}
add_shortcode('prezzi', 'get_sheet_value_prezzi');
-
This reply was modified 3 years ago by
openaspace.
-
This reply was modified 3 years ago by
openaspace.
I have correct the pasted code for formatting errors.
-
This reply was modified 3 years ago by
openaspace.
Mine the same, I have 1 particular page the there is no output and I cannot understand why. Other pages are ok. Only 1 particular page has an issue.
I have verified that other plugins/code using Google API, after the latest WordPress upgrade are not working anymore.
On different websites on different hosting the problem is with http referer, it you force it inside the API call your code will work…
-
This reply was modified 3 years ago by
openaspace.
It sounds like this has to do with the Google API not working correctly, instead of anything that can be fixed within Code Snippets.