Skip to content

Instantly share code, notes, and snippets.

@amdrew
Created September 7, 2014 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amdrew/da48b8f18eb9afa777e0 to your computer and use it in GitHub Desktop.
Save amdrew/da48b8f18eb9afa777e0 to your computer and use it in GitHub Desktop.
Easy Digital Downloads - Disallow admins from logging in via the login form
<?php
function sumobi_edd_login_form_restrict( $redirect, $user_id ) {
if ( current_user_can( 'manage_options' ) ) {
wp_logout();
edd_set_error( 'admin_login_disabled', __( 'Admins cannot login via this form', 'edd' ) );
}
return $redirect;
}
add_filter( 'edd_login_redirect', 'sumobi_edd_login_form_restrict', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment