This topic contains 1 reply, has 2 voices, and was last updated by Sofia Moss Sofia Moss 1 year ago.

Only showing SSF code on one page of WordPress site and Google API key

  • Currently SSF adds a script tag to all pages of my site, listing it’s full configuration info.

    I don’t need that SSF code on all pages because SSF is only shown on the Retailer Search page of our website. How can I set it so that SSF only adds it’s code to that one page/url? What file in my WordPress install do I edit for this?

    Also, within this script tag it shows all of SSF’s settings. Is this safe? I’m specifically worried about it publicly showing this line in that script tag…

    var google_api_key='OURGOOGLEAPIKEYHERE';"

    I even got a warning email from Google with subject-line “Publicly Accessible Google API Key”. Isn’t it not good to show this key like this (especially in a script tag)?

    Sofia Moss
    StaffSuper ContributorUser Level

    Hi there,

    If you refer to the latest Patch Notes here, Google API key will no longer be visible and you can refer to this knowledge base article for the upgrade instructions.

    For the plugin asset, you can try to go to admin settings page and set Load Plugin Asset to Plugins Page only. This will still show the asset at the home page. If you don’t plan to use the store locator at home page, you can try to edit wp-content/plugins/superstorefinder-wp/ssf-wp-functions.php

    Try to search for below code

    if ($show_on_all_pages || $on_ssf_wp_page  || $show_on_archive_404_pages || $show_on_front_page  || $on_ssf_wp_post || $show_on_custom_post_types || function_exists('show_ssf_wp_scripts') || $show_on_page_templates || $plugin_asset_all_pages=='true') {

    replace it with:

    if ($on_ssf_wp_page  || $show_on_archive_404_pages)

    Save and upload and refresh the page.

    Cheers,
    Sofia

The topic ‘Only showing SSF code on one page of WordPress site and Google API key’ is closed to new replies.