Skip to content

Instantly share code, notes, and snippets.

@koen12344
Created February 6, 2024 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koen12344/63fa57ac1f27292758fdaf6932d951a4 to your computer and use it in GitHub Desktop.
Save koen12344/63fa57ac1f27292758fdaf6932d951a4 to your computer and use it in GitHub Desktop.
<?php
function pgmb_do_something_with_api() {
global $post_to_google_my_business;
if(!$post_to_google_my_business->is_loaded()){
return;
}
$container = $post_to_google_my_business->get_container();
if(!$container){
return;
}
$api = $container['google_my_business_api'];
$location_id = 'locations/5083214136172243061';
$localPost = new \PGMB\Google\LocalPost('en', 'post text here', 'STANDARD');
$api->create_post($location_id, $localPost);
}
add_action( 'init', 'pgmb_do_something_with_api' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment