ACF link
-
Hi Phi,
Mario here again:)
I have an ACF field with an url called try_link. Want to display a link with href=”try_link” in a button text: “Use Template”
Tried to use, but the link is going to the post:(add_filter( 'meta_field_block_get_acf_field', function ( $block_content, $post_id, $field, $raw_value ) { $field_name = $field['name'] ?? ''; // Replace your_field_name with your unique name. if ( 'try_link' === $field_name && $block_content !== '' ) { $block_content = sprintf('Use Template', get_permalink($try_link), $block_content); } return $block_content; }, 10, 4);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘ACF link’ is closed to new replies.