I have blog and forum, and I need to put wordpress external logout link. What files do I need to add to make wp_logout_url(); work?

Thank you.

  • wp_logout_url uses functions such as apply_filter, wp_nonce_url, add_query arg. It is found in general-template.php. God knows what other Wordpress functions are being used in that file? Basically, you'd have to load Wordpress in its entirety. Which is why you would be much better off just finding out what the link is and then hardcoding it.
    – user5028
    Nov 13, 2012 at 8:48
  • @Calle you can't hardcode the link since it needs a nonce. Nov 14, 2012 at 12:29
  • @TheDeadMedic I did not think to look that up! But if that's how it is then that's not very good. I still don't like the overhead of wp-blog-header.php just for one tiny link but in that case, that's probably the easiest way out.
    – user5028
    Nov 14, 2012 at 19:07

1 Answer 1


To allow WordPress functions to operate outside of the WordPress environment, you need to let your external pages know about and have access to the WordPress Core and API environment.


The above link is one such reference which covers this very purpose.


In order to transform regular PHP pages into ones that utilize WordPress, you need to add either of the following code snippets to the start of each page.

/* Short and sweet */
define('WP_USE_THEMES', false);



Getting your paths right is very important, without, you'll have no joy.

Refer to the link provided for even greater detail. Any problems thereafter please let us know along with what you have tried, code samples used, etc.

Good luck!

  • I would advise loading wp-load.php, as wp-blog-header.php will handle requests (which the OP probably won't want). Nov 14, 2012 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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