In my template I have href="'.$package_link->guid.'"

The resulting HTML is: href="http:/package/download-2023-friday-arrival-monday-departure-weekend-coach-festival-ticket/"

Why is the http:/ being added? I am using Advanced Custom Fields with the field setup as below. Any suggestions?

enter image description here

1 Answer 1


You should not be using the GUID as a link. If you want to get the URL for a WordPress post object you should use get_the_permalink():

href="' . esc_url( get_the_permalink( $package_link ) ) . '"

Note that I also escaped the URL.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.