Skip to Content
Menu

google_review_url()

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

PHP February 25, 2022

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 »

Examples

Get a review URL from the Place ID in Nebula Options

PHP
google_review_url();

Or explicitly with the Nebula Options name (just for reference)

PHP
google_review_url(nebula()->get_option('google_place_id'));

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.

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

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

    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 = ( is_array($nebula_options) )? $nebula_options['google_place_id'] : false; //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?