diff --git a/includes/core/um-filters-account.php b/includes/core/um-filters-account.php index c460102d..7b963c3a 100644 --- a/includes/core/um-filters-account.php +++ b/includes/core/um-filters-account.php @@ -43,4 +43,19 @@ function um_account_sanitize_data( $data ) { return $data; } -add_filter( 'um_account_pre_updating_profile_array', 'um_account_sanitize_data', 10, 1 ); \ No newline at end of file +add_filter( 'um_account_pre_updating_profile_array', 'um_account_sanitize_data', 10, 1 ); + + +/** + * Fix for the account field "Avoid indexing my profile by search engines" + * @since 2.1.14 [2020-12-15] + * @param bool $value + * @return int + */ +function um_account_profile_noindex_value( $value ) { + if ( ! is_numeric( $value ) ) { + $value = (int) get_user_meta( um_profile_id(), 'profile_noindex', true ); + } + return $value; +} +add_filter( 'um_profile_profile_noindex_empty__filter', 'um_account_profile_noindex_value' ); \ No newline at end of file