Skip to Content

google_review_url()

Easily link to the “Write a Review” prompt in Google for your business.

PHP April 3, 2020

Usage

PHP
google_review_url($place_id)

Parameters

$place_id
(Optional) (String) The Place ID generated from Google
Default: None

Parameter Notes

Generate a Place ID here by searching for your business.

If a Place ID is not passed to this function, it will try to pull it from Nebula Options. If neither are available it will return false.

Request or provide clarification »

Additional Notes

The Google Place ID can be entered in Nebula Options where this function will look if a specific Place ID is not included when this function is called.

Note: This URL will appear in the Administrative metabox in the WordPress admin Dashboard where it can be easily copy and pasted by anyone. This link will only appear if the Place ID has been entered into the Nebula Option.

Source File

Located in /libs/Options/Options.php on line 114.

No Hooks

This function does not have any filters or actions available. Request one?
PHP
        public function google_review_url($place_id=''){
            if ( empty($place_id) ){
                $nebula_options = get_option('nebula_options');
                $place_id = $nebula_options['google_place_id']; //Note: This may still be empty
            }

            //Return a Google Review link if we have a Place ID
            if ( !empty($place_id) ){
                return 'https://search.google.com/local/writereview?placeid=' . $place_id; //come up with a default
            }

            return false; //Otherwise we do not have a URL
        }

Override

This function can not be short-circuited with an override filter. Request one?