This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!
Copyright © Useful Snippets. 2022 • All rights reserved.
Cedar WordPress Theme by EckoThemes.
Published with WordPress.
A shortcode for displaying Link Picker fields in Advanced Custom Fields!
Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Visit my other blog
Tried to add the code to functions.php , testes the shortcode and didn’t work…
Hard to say. Are you sure that the `field` attribute matches the name of your ACF Field? You can try using `var_dump(get_field(‘field_name’));` in a template to see if you can get the `field_name` field to show up. If it does, it should work like this as well: `[acf_link_picker field=”field_name”]`
Yes, the name is correct, i’ve tested it.
The field name is “product” and I changed on your code “‘field’ => ‘mylink'” to “‘field’ => ‘product'”.
Am I wrong?
It only displays on the text field with the shortcode, the shortcode itself.
It sounds like the shortcode didn’t get loaded properly. Add the code in your themes functions.php file or in a plugin.
Save my name, email, and website in this browser for the next time I comment.
Notify me of followup comments via e-mail. You can also subscribe without commenting.