@blueli The http(s)://
is the protocol part of the URL; it tells the browser that it’s an external link. An href
without a protocol is treated as an internal link.
If you’re removing the protocol for display reasons, you should save that to a separate variable instead.
Also, if you want to remove trailing slashes, there is a native WP function called untrailingslashit()
or trailingslashit()
for the opposite effect.
Good luck!