How do I protect my searchbar to site strangers?

How do I protect my search bar from being used by visitors to the site that I have deemed as "strangers"? I don't want them to be able to search because it is bringing back a lot of results with a lot of content I don't want non-registered members of the site seeing.

Thanks!

  • Elliott Bristow

    Hi @court,

    Depending on your setup you could do this using a do_shortcode function in your theme. For example, if you find the part of your theme that grabs your search bar, you could wrap it in a shortcode as follows:

    <?php do_shortcode('[not-level-visitor]' . get_search_form(false) . '[/not-level-visitor]'); ?>

    Assuming you have an access level set up called "visitor" this will hide your search bar from anyone on that access level.

    Give it a try and let me know how it goes!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.