Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to get acf in taxonomies #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

omaretna
Copy link

addACFDataTermV2 function don't add acf to taxonomies term i suppose with get_taxonomies() it will be better.
tell me if i miss something or there is other way to get this data.

thanks.

addACFDataTermV2 function don't add acf to taxonomies term i suppose with get_taxonomies() it will be better.
tell me if i miss something or there is other way to get this data.

thanks.
@chrishutchinson
Copy link
Contributor

Thanks for this @omaretna - I'll do some testing later this week and hopefully fold this in. Just to clarify, is this to ensure custom terms within taxonomies have ACF data, or something else?

@omaretna
Copy link
Author

Welcome, its to add ACF to custom taxonomies because when your put register_api_field(term, acf...) that dont do nothing in V2. :)

@kokarn
Copy link
Contributor

kokarn commented Mar 9, 2016

IMO this fix is incomplete.

From Beta 11 there is no longer any endpoints for term, you need to change it to tag and/or category which in our case means both.

A proposed fix could be

function addACFDataTermV2() {
    register_rest_field( 'tag',
        'acf',
        array(
            'get_callback'    => array( $this, 'addACFDataTermV2cb' ),
            'update_callback' => null,
            'schema'          => null,
        )
    );

    register_rest_field( 'category',
        'acf',
        array(
            'get_callback'    => array( $this, 'addACFDataTermV2cb' ),
            'update_callback' => null,
            'schema'          => null,
        )
    );

    register_rest_field( get_taxonomies(),
        'acf',
        array(
            'get_callback'    => array( $this, 'addACFDataTermV2cb' ),
            'update_callback' => null,
            'schema'          => null,
        )
    );
}

@omaretna
Copy link
Author

omaretna commented Apr 21, 2016

i think that

`register_api_field( get_taxonomies(),
            'acf',
            array(
                'get_callback'    => array( $this, 'addACFDataTermV2cb' ),
                'update_callback' => null,
                'schema'          => null,
            )
        );`

cant just work fine because get_taxonomies() contain tag and categories i think for v2 there is category but maybe i am wrong.

@mgiraldo
Copy link

mgiraldo commented Jan 9, 2018

any news on this? i am using ACF to REST API and was thinking of using this plugin instead but i need taxonomy support.

@omaretna
Copy link
Author

omaretna commented Dec 8, 2018

Hy @chrishutchinson did you check this pull request ?
@mgiraldo you can use this plugin and take changes of this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants