"Hide" the Add Listing button in the header from non-logged in users

I would like to “hide” the Add Listing button if a user is not logged in, or if the logged in user is not a registered vendor. I found a script similar to what I need, but this script not only “hid” the Add Listing button in the page header, but also disabled the Sign In link altogether for non-registered vendor (which I don’t want). I have a replica button in a vendor-dedicated page, that potential vendors can use to register and submit their first listing. I want Vendors to register the first time from the ‘dedicated Vendors page’, and once they are registered and their listing approved, only then they will start start seeing the Add Listing button in the header menu.

Can someone help me with a script which only “hides” the header Add Listing button for non-vendors, but still keeps the same link, manually put on other pages, functional?

Thank you!

1 Like


Please use this PHP snippet How to add custom code snippets - HivePress Help Center : Hide the Add Listing button from regular users #hivepress #listings · GitHub

​I hope this is helpful to you.

Dear andrii,

thank you for your reply. The problem with this snippet is that , apart from ‘hiding’ the Add Listing button from the header, it also disables the link: https://mydomain/submit-listing altogether so it does not allow me to put this functionality on a separate page for potential vendors to apply the first time around.

Is there a way to ONLY disable the button from showing in the header but still allow the “submit-listing” link to work elsewhere?

Thank you for your continued support!


I see. Please try to use this CSS snippet:

This CSS will disable the Add Listing button all the time - can you please point me to an example how I can put the CSS snippet inside a PHP snippet to only run it when a NON-vendor is accessing the site? I want registered vendors to still see the Add Listing button, but want to hide the button to non-vendors.

The ‘logic’ in the first PHP snippet suggested is good, the issue was that it disabled the form altogether rather than just ‘hide’ the button. So if I can apply CSS snippet using the logic in the PHP snippet, it would work great.

What I need is this:

Vendor logged in: “Add Listing” in header is displayed
User not logged in or not a vendor: “Add Listing” button in header does not show, however the form ‘https://mydomain/submit-listing’ still works if accessed directly (used to register new vendors from a dedicated page).


Could you please provide more details on how you differ vendors from ordinary users on your website? Then we can help you with a solution.

Hi andrii,

We are using the default ListingHive theme. In our case, to become a vendor one must visit a custom, vendors-dedicated page which explains who can become a vendor and allows users to submit their first listing using the /submit-listing form: thus the user must first create an account (if they don’t already have one), then 2nd step is to complete their vendor profile and final step is to fill in the listing details. Once their listing is approved by the administrator, the user becomes a vendor.

Since in our case we envisage that the website will be used far more by normal ‘users’ rather than vendors, it does not make sense for us to have the “Add listing” button so prominent on the website header for everyone to see. We want the button to be only visible in our custom, dedicated ‘vendors-page’ (this page will be accessible and visible to everyone even non-logged-in users, but it will explain who is eligible to ‘add listing’ etc). Only when a registered vendor logs in, we want the “Add Listing” button to also show in the website header.

The idea is to give existing vendors easy access to the “Add Listing” button without confusing non-Vendors with such a prominent button on the website.

Thank you for your continued support


I see. Please try to use this CSS snippet:

Dear andrii,

thank you for your continued support. I see that you have changed my question from:
“Hide” the Add Listing button in the header for non-logged in Vendors
“Hide” the Add Listing button in the header for non-logged in Users

Whilst the CSS snippet you provided works well for the ‘updated’ question, my original request is that ONLY approved Vendors should see the Add Listing button in the header, not ANY logged-in user.

Is there any way to alter the snippet to show the button ONLY when an approved VENDOR is logged in, not just any user?

N.B.: I only want to ‘hide’ the button, not disable the /submit-listing form altogether, as I still need to access this form from another page for potential vendors to register through it.

Thank you


Unfortunately, there is no simple snippet here, it will require a custom implementation.