Created
June 26, 2013 12:01
-
-
Save hlashbrooke/5866863 to your computer and use it in GitHub Desktop.
Adding filter to woocommerce_prevent_admin_access()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function woocommerce_prevent_admin_access() { | |
$prevent_access = false; | |
if ( get_option('woocommerce_lock_down_admin') == 'yes' && ! is_ajax() && ! ( current_user_can('edit_posts') || current_user_can('manage_woocommerce') ) ) { | |
$prevent_access = true; | |
} | |
$prevent_access = apply_filters( 'woocommerce_prevent_admin_access', $prevent_access ); | |
if( $prevent_access ) { | |
wp_safe_redirect(get_permalink(woocommerce_get_page_id('myaccount'))); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment