Following this comment, the initiator added:
in my case, we used the Load Balancer server and the SSL certificate was installed on the load balancer
Reply from @pbond scratched the surface to the root cause of the problem. The WordPress function is_ssl() checks $ _SERVER ['HTTPS'] and $ _SERVER ['SERVER_PORT'] to check if the current page is accessible via https, but the load balancer most likely requests your content on a port other than SSL 80.
A good solution for this is to use the X-Forwareded-Proto HTTP header to determine which protocol the client actually uses on the other side of load balancing.
With Apache 2.2, you can add this to your configuration:
<IfModule mod_setenvif.c> SetEnvIf X-Forwarded-Proto "^https$" HTTPS </IfModule>
Another possible fix (mentioned by @Roberto Poblete but not explained) is to add this to wp-config.php
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS'] = 'on';
I have it thanks for sending me directly
source share