I want to link plain text with a Page Link type field, but when I do, the url breaks (it leaves off the colon of “https://”).
I type “whatever I’m linking” on my Page, edit my example_page_link Field to point to a page on my site. In the block editor I highlight “whatever I’m linking” and click the chain icon to add a link, then type in the shortcode “[acf field=example_page_link]” in the address section.
“whatever I’m linking” DOES become hyperlinked on the live page that’s rendered, but when I click the link, the page appears broken because the colon of the “https://” is missing (I get “https//…”). If I just put the raw shortcode on the page [acf field=example_page_link], the entire link renders as text, is itself hyperlinked, and works properly.
The code snippet below creates a new shortcode called “[my_special_link]” that takes two parameters:
1. acf_link_field : the ACF field name you want to call on (assuming it’s a link type field)
2. text_value : the text you want to hyperlink on top of
[my_special_link acf_link_field="example_page_link" text_value="Whatever I want"]
This adds the text “Whatever I want” to the page and hyperlinks it to the ACF field link at field=example_page_link.
You could adapt this code to chain together however many ACF fields you wanted.