-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
[Block] Login/outAffects the Login/out BlockAffects the Login/out Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.A suggestion for improvement.
Description
What problem does this address?
Our current method for retrieving the current URL is as follows:
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
This approach relies on is_ssl()
and $_SERVER['HTTP_HOST']
, and it accesses $_SERVER['HTTP_HOST']
without checking if it is set. It also lacks proper usage of wp_unslash()
and sanitization.
What is your proposed solution?
Why rely on $_SERVER['HTTP_HOST']
and is_ssl()
when we can construct the URL directly using:
home_url( wp_unslash( sanitize_url( $_SERVER['REQUEST_URI'] ) ) )
This provides a more secure and WordPress-native approach.
Metadata
Metadata
Assignees
Labels
[Block] Login/outAffects the Login/out BlockAffects the Login/out Block[Status] In ProgressTracking issues with work in progressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.A suggestion for improvement.