# 如何防止部分 WordPress 用户登录 Discourse

**URL:** <https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234>\
**Category:** WordPress\
**Created:** [2018 年7 月 26 日 19:55 UTC](https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234 "2018-07-26T19:55:22Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

作者： ![Ryan\_Collins1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryan_collins1/32/76781_2.png) [@Ryan\_Collins1](https://meta.discourse.org/u/Ryan_Collins1)\
发布日期： [2018 年12 月 19 日 15:56 UTC](https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234/7 "2018-12-19T15:56:08Z")

</div>

Yes, I am using the [WP Discourse](https://github.com/discourse/wp-discourse).

Thanks for sharing this code about how to prevent some WP users from being able to login to Discourse. Big help!

I just have 3 additional questions for whenever you are able to reply:

1. Should I add that code to my theme’s functions.php file?

2. When a member cancels, they transition in wordpress from being a “s2Member Level 1” to a “Subscriber” - should I put if ( /\* Subscriber \*/ ) { in order to make it work?

3. If want to redirect Subscribers to a different page aside from the homepage, do I just change home\_url with a the url of my billing update page? (wp\_safe\_redirect( [myfishingcapecod.com/billing-update-page/()](http://myfishingcapecod.com/billing-update-page/()) );

Thank you very much for the support. Huge help!

---

_[View the full topic](https://meta.discourse.org/t/how-to-prevent-some-wp-users-from-being-able-to-login-to-discourse/93234)._
