I want to use is_user_logged_in() in my home page so users that are not logged in see a sign up page.

I want to know if this function blocks search engine bots from crawling the content inside is_user_logged_in().

If it is blocked; then, how can I allow search engines to crawl the content inside it?


I apologize for not making my question clear enough.

Maybe I should post another question on a more appropiate section; however, here it goes, I want to redirect not logged in users who visit my homepage to a sign up page, but still allowing search engine bots to index my homepage content.

Is this possible without infringing search engines rules as Rarst mentioned in the comments?

  • 2
    Note that showing bots content different from normal visitor might be seen as trying to cheat the system by them and penalized.
    – Rarst
    Jan 31, 2015 at 19:03
  • @Rarst what If I only redirect non logged in users to a sign up page?
    – Gixty
    Jan 31, 2015 at 19:06

1 Answer 1


If you wrap some content in a is_user_logged_in() condition, all that content will only be rendered to users who have an account on your website and are logged into that account.

Now, do Google bots have an account on your website? Hell no. So no, that content will never be indexed by Google in your website. Also, it will never be visible to any of your not logged in visitors (that's more than 90% of your visitors, unless you have some community website where people need to log in in order to use it).

The bright side of this technique is that the bad bots won't be able to see that content either.

So the answer to your question is:

Yes. is_user_logged_in() hides content for all bots (excluding the ones intelligent enough to create accounts on your website and log in) and for about 90% of the average websites' visitors (because people are lazy and never log in even if the do have accounts, unless they need to: you force/lure them to do so).

Well, here's the updated answer for your updated question:

Normally, what you're trying to achieve is not technically possible. It would be, if any SE would provide a method for it, using perhaps an account you make with them (think analytics account). But as of now that's not an option.

About SE rules and policy, you'd be infringing SE rules if you tried to detect SE bots and fed them different content than what you feed to normal logged out users.

  • Good. Now, how can I allow search engines to crawl the content wrapped in is_user_logged_in ()?
    – Gixty
    Jan 31, 2015 at 19:00
  • Let's make something clear. If you wrap some content in a is_user_logged_in(), search engines cannot see that content, because the page is rendered without that content for any user that is not logged in. Therefore is_user_logged_in() is the safest and most common method to hide content from all bots, including search engines. Other methods of hiding allow SE bots to see the content and advise them not to index it, but the decision is left at the SE's discretion and policy (to follow your advice or not), because the bot sees the content and can index it.
    – tao
    Jan 31, 2015 at 20:01
  • In short: 1. do not use is_user_logged_in() on content you want indexed. 2. use a robots.txt to give SE's more information about the content they find on your website (what's important, what's not, etc...)
    – tao
    Jan 31, 2015 at 20:07
  • Thanks for your answers, I understand what you are saying; however, I edited my question because I was not clear enough on what I want to achieve. Sorry for that.
    – Gixty
    Jan 31, 2015 at 20:33
  • Updated answer for updated question.
    – tao
    Jan 31, 2015 at 22:01

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .