Skip to content

Instantly share code, notes, and snippets.

@1naveengiri
Created July 27, 2020 03:23
Show Gist options
  • Save 1naveengiri/32e25f4a88fbec058435fd8a30597550 to your computer and use it in GitHub Desktop.
Save 1naveengiri/32e25f4a88fbec058435fd8a30597550 to your computer and use it in GitHub Desktop.
Geodirectory - Restrict user from checking other user profile
<?php
add_shortcode( 'gd_access_denied', 'restrict_user_access_for_other_profile' );
function restrict_user_access_for_other_profile( $atts ) {
if( !is_uwp_current_user_profile_page() && !current_user_can('administrator') ){ // if its users profile.
wp_redirect( home_url() ); exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment