Blocking Admin Login from the MemberPress Login Form
MemberPress is one of the best membership plugins for WordPress. The features are amazing and I recommend it without any hesitation. The topic of this post is regarding the login form that is included with MemberPress and preventing admin access via that form.
Recently, I needed a way to block administrative login from the MemberPress login form. The reason I needed to do this was for security purposes. The wp-login and wp-admin had been protected but the protections in place were basically useless if admin login could be completed via the MemberPress login form. The goal was to force admin login to be completed using the protected wp-login page. I figured the best way to start was to send a message to the MemberPress support guys. After a few days, I got an email back with some custom code to achieve exactly what I wanted. I was very impressed because that definitely exceed my expectations (I was planning on having to write some code myself). So a big thanks for Paul at MemberPress for hooking me up with the code.
For anyone who wants to block admin access via the MemberPress login form, here’s the code (NOTE: this code only blocks ADMIN access). You can paste it into your functions.php or in a custom plugin.
Paul C says
Thanks for sharing this!
Just a heads up – missing semi-colon here: http://cspf.co/hQRY/Image%202016-09-09%20at%2010.39.26%20AM.png
Ren says
Good catch! Thanks for the heads up. Fixed.