diff --git a/includes/core/um-actions-profile.php b/includes/core/um-actions-profile.php index bb3eb6c8..33819c07 100644 --- a/includes/core/um-actions-profile.php +++ b/includes/core/um-actions-profile.php @@ -739,7 +739,6 @@ function um_profile_dynamic_meta_desc() { '@context' => 'https://schema.org', '@type' => 'ProfilePage', 'dateCreated' => um_user( 'user_registered' ), - 'dateModified' => gmdate( 'Y-m-d H:i:s', um_user( 'last_update' ) ), 'mainEntity' => array( '@type' => 'Person', 'name' => esc_attr( $title ), @@ -751,6 +750,18 @@ function um_profile_dynamic_meta_desc() { ), ), ); + $user_last_update = um_user( 'last_update' ); + if ( ! empty( $user_last_update ) ) { + if ( is_numeric( $user_last_update ) ) { + $user_last_update = (int) $user_last_update; // cast numeric type to int + } else { + $user_last_update = strtotime( $user_last_update ); // cast string date type to int + } + if ( ! empty( $user_last_update ) ) { + $person['dateModified'] = gmdate( 'Y-m-d H:i:s', $user_last_update ); + } + } + /** * Filters changing the schema.org of profile's person. *