Skip to content

Commit e38d661

Browse files
committed
Tweak logic order so wpum_get_option doesn't get called on every page load
1 parent 9a6528f commit e38d661

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

includes/actions.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,13 +406,12 @@ function wpum_reset_password_redirect() {
406406
* @return void
407407
*/
408408
function wpum_restrict_profile_page() {
409+
$profile_page = wpum_get_core_page_id( 'profile' );
409410

410-
$is_profile_disabled = wpum_get_option( 'disable_profiles' );
411-
$profile_page = wpum_get_core_page_id( 'profile' );
412-
413-
if ( true === boolval( $is_profile_disabled ) && is_page( $profile_page ) ) {
411+
if ( $profile_page && is_page( $profile_page ) && true === boolval( wpum_get_option( 'disable_profiles' ) ) ) {
414412
wp_safe_redirect( home_url() );
415413
die();
416414
}
417415
}
416+
418417
add_action( 'template_redirect', 'wpum_restrict_profile_page' );

0 commit comments

Comments
 (0)