• Resolved Marcel Bootsman

    (@mbootsman)


    Hi everyone,

    I have a Block Pattern that I want to use on a custom post type (CPT) called “episodes”. The pattern contains a Group block with a Buttons block, and inside that there are three Button blocks.

    What I want to achieve is: make each of the three buttons automatically link to the values of three ACF fields on the post: url1, url2, url3 (ACF field type: URL). The goal is that I can update the pattern later if needed, without having to edit all existing posts.

    What I’ve already done:

    • The ACF field group is assigned to the CPT “epsodes”.
    • “Show in REST API” is enabled for the field group in ACF.
    • The fields have “Allow access to value in editor UI” enabled.
    • The fields already have values saved on the posts.

    Question:
    What is the best and most future-proof way to approach this in WordPress (Block Editor / Patterns)? Specifically:

    • Can I bind the Button href (link URL) to ACF field values, and if so how?
    • If this is not supported (yet), what is the recommended alternative (code-based approach, dynamic block, plugin approach, etc.)?

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘ACF URL fields in Block Patterns: dynamically set Button href per post (CPT)’ is closed to new replies.