-
aaronmckeon
I’m trying to link a heading block to a dynamic URL. The URL contains a string such as “www.website.com”. Whenever I insert
{{post_meta key:website}}it keeps updating it tohttp://{{post_meta key:website}}. How do I get this to work? Please note the text of the link itself isn’t dynamic. In this case, it’s “Website” – only the hyperlink is dynamic. -
Hi there,
If it’s a link, it is normal to add the https before the site link.
Why do you not want it? -
aaronmckeon
Because it’s already in the post meta, so it ends up being something like
http://https://website.com. -
George
Hi Aaron,
To make sure we point you in the right direction, could you clarify a few things?
- What is the field type for your website custom field — is it an ACF URL field, a plain text field, or something else?
- What does the actual stored value look like? For example, is it
www.website.com,https://www.website.com, or something else? - Where are you seeing the
http://being added — in the block editor preview, or only on the live frontend?
-
aaronmckeon
I looked into this a little further. The field is an ACF text field that’s populated through a custom integration with an external CMS (the custom code modifies the post meta). The integration sometimes populates it with the https:// and sometimes without it. For example, one might be
http://www.visitcherokeecountync.comand another might bewww.andrewschamber.com/. Perhaps the best way to fix this would be to modify the integration code to properly format the URL and then convert the ACF field to the URL type? Let me know what you advise. I inherited this website from somebody else so I’m trying to get things cleaned up. Should I not include the https:// in the value that’s stored since it seems GenerateBlocks likes to add that in? -
Should I not include the https:// in the value that’s stored since it seems GenerateBlocks likes to add that in?
You can do so.
-
aaronmckeon
That fixed it, thanks.
-
No Problem 🙂
- You must be logged in to reply to this topic.