Support

Account

Home Forums General Issues Getting ACF Fields Values From a Subdomain

Solved

Getting ACF Fields Values From a Subdomain

  • Hi everyone,
    I need to retrieve ACF fields values from posts located on another WordPress install on a subdomain.
    I’m thinking about the best way to do it.
    Should I try to use ACF methods?
    Build a straight sql query to the subdomain DB?
    I don’t really know where to start.

    Thanks in advance.

  • Are you talking about a mutlisite installation?

    If you want to use ACF on mutlisite and you want to get values from another sites.
    1) The ACF fields must exist on both sites
    2) Use switch_to_blog() https://developer.wordpress.org/reference/functions/switch_to_blog/

    If you follow the above everything else should work according to ACF documentation.

  • Hello John, thank you to be here.

    It’s not a multisite installation.
    There are two distinct websites (A.org and B.A.org) and two distinct directories on the same server. B is on a subdomain.

    Some ACF fields will be populated on the admin side in posts (a repeater and few booleans) on website A.org.
    I have to get the values of these fields to include them in a form to be filled by visitors on website B.A.org.

    The form on B.A.org will be the same for every post except for the few fields coming from A.org which will be specific to each post.

    Does that make sens?

  • There isn’t a way to use function to get ACF values from a separate WP installation. You’ll need to build a separate application either by doing DB queries directly on the DB for the other site or by using some type of API an possibly CURL to get the values from the other site.

  • I get it. Thank you for replying.
    I’m doing trials right now using wpdb.
    I’m struggling to filter repeater data this way but looks promising.

    Silly idea:
    Is it possible to create an ACF object from data on the fly (in memory) then use ACF methods on it?

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Getting ACF Fields Values From a Subdomain’ is closed to new replies.