WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a link that goes to wp-login.php for whatever domain I'm at now. Something like:

<a href="http://<script>document.write(document.domain);</script>/wp-login.php">Login</a>

But I don't know how to write / format that properly.

share|improve this question
What is the context in which this needs to work? – s_ha_dum Jan 9 '13 at 17:35
it's in a php script – Xue Faith Jan 9 '13 at 23:09
<?php wp_loginout(); ?>


<a href="http://<?php bloginfo('url'); ?>/wp-login.php">Login</a>

What am I missing?



share|improve this answer

If it is for the same domain something like this would also suffice:

<a href="/wp-login.php">Login</a>

But if you have the Wordpress api available the wp_loginout() function is the best available option.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.