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

Wordpress 4.8 breaks the plugin #176

Closed
bovas85 opened this issue Sep 15, 2017 · 36 comments
Closed

Wordpress 4.8 breaks the plugin #176

bovas85 opened this issue Sep 15, 2017 · 36 comments

Comments

@bovas85
Copy link

bovas85 commented Sep 15, 2017

Hi there, I can't see the "settings" section in the plugins page for act-to-rest-api, and in advanced custom fields I don't see the switches to show / edit the custom field in the api.

screen shot 2017-09-15 at 12 51 35

screen shot 2017-09-15 at 12 50 56

@airesvsg
Copy link
Owner

Hi @bovas85,
please rename the plugin folder to: acf-to-rest-api and activate again.

Thanks

@bovas85
Copy link
Author

bovas85 commented Sep 15, 2017

Hi @airesvsg , that's the folder name in the plugins but it doesn't show any setting there.

I'm getting it to show in the rest call now, but I still can't choose whether to have it be editable or not

@airesvsg
Copy link
Owner

Hi @bovas85,
Please, copy the filters below and paste in your functions.php to enable the settings.

// Enable the option show in rest
add_filter( 'acf/rest_api/field_settings/show_in_rest', '__return_true' );
// Enable the option edit in rest
add_filter( 'acf/rest_api/field_settings/edit_in_rest', '__return_true' );

https://github.com/airesvsg/acf-to-rest-api#field-settings

Thanks

@khejit
Copy link

khejit commented Sep 20, 2017

@airesvsg
I have a fresh WP 4.8 installation, ACF 4.4.11 and ACF to REST API 2.2.1.
I copied provided filters to functions.php and re-activated plugin, plugins folder is called acf-to-rest-api, and I do not see settings of this plugin nor options "Show in REST API", "Edit in REST API".

Requests like /wp-json/acf/v2/post/1 work though.

@airesvsg
Copy link
Owner

Hi @khejit,
I tested it now and I saw the options.
Thanks

names

plugins

ACF 4.4.11
acf-free

ACF PRO 5.6.2
acf-pro

@sethcmiller
Copy link

Hi @airesvsg,
Those fields are not showing up in my experience. I have deactivated them, reactivated the plugins and tried creating new fields, etc and they still aren't showing up for me. Please see screenshots below:
image
image

Any other recommendations?
Thanks,
Seth

@airesvsg
Copy link
Owner

Hello @sethcmiller,

Did you use those filters?
https://github.com/airesvsg/acf-to-rest-api#field-settings

Thanks

@sethcmiller
Copy link

sethcmiller commented Sep 20, 2017

Thanks for the reply, @airesvsg,
Yes, I am using them in my theme's functions.php file:
image

Any other ideas?
Seth

@EvanAgee
Copy link

Ditto, any fix for this?

@airesvsg
Copy link
Owner

@sethcmiller Can you send your files ( theme and database dump ) to my email?
airesvsg@gmail.com

@EvanAgee In my tests, I can't simulate the error.

Thanks

@adamjw3
Copy link

adamjw3 commented Sep 28, 2017

@airesvsg I had the same issue when i had got the plugin from wordpress. If i use the beta version from git it works.

How do you get all the fields back? acf and standard wordpress in one call for a post or group of posts?

@adamjw3
Copy link

adamjw3 commented Sep 29, 2017

@airesvsg actually it doesn't work on version 4.8. This is pretty urgent, when will a fix be available?

@bovas85
Copy link
Author

bovas85 commented Sep 29, 2017

There are other plugins that work

@airesvsg
Copy link
Owner

Please, send me your files.
airesvsg@gmail.com

@adamwright32
Copy link

Which plugins work? Many thanks. Will send files Monday

Repository owner deleted a comment from bovas85 Sep 30, 2017
@adamwright32
Copy link

@airesvsg i've sent those files to you

@airesvsg
Copy link
Owner

airesvsg commented Oct 2, 2017

Hi @adamwright32,
I haven't received your files yet.
Thanks

@adamwright32
Copy link

@airesvsg just sent again but this time via we transfer

@airesvsg
Copy link
Owner

airesvsg commented Oct 2, 2017

Hi @adamwright32,
please, put the filters in the top of functions.php and it's will work.
I sent for your email the functions.php.
Thanks

@mathishuettl
Copy link

Hello,

same problems.

Wordpress Version: 4.8.2
ACF Pro Version: 5.6.2
Theme: Twentyseventeen

I added the Filters in top of my functions.php

I don't see the options

@adamwright32
Copy link

@airesvsg thats still not work, sent you an email.

@obedparla
Copy link

obedparla commented Oct 3, 2017

Same issue here. Added filters to functions.php and still doesn't work.

Wordpress: 4.8.2
ACF Pro: 5.6.2
ACF to rest api: both 2.2.1 (latest from WP plugins) and the beta version 3.0.1 from github.

Deactivated plugins a few times, recreated CFs and nothing.

Edit:

Accessing /wp-json/wp/v2/game_reviews?_embed (where game_reviews is a custom post type) works. I can see all of the ACF fields! However the option to show them on the rest api inside ACF (as showed by @sethcmiller ) is not there yet.

@vicocotea
Copy link

Almost same issue for me.
I can't see the 'Settings' link in plugins page. I tried to enable V3 with :

define('ACF_TO_REST_API_REQUEST_VERSION', 3);

and also :

add_filter( 'acf/rest_api/field_settings/show_in_rest', '__return_true' );
add_filter( 'acf/rest_api/field_settings/edit_in_rest', '__return_true' );

but V3 API calls are not working (404) and buttons Edit/Show in rest aren't visible.
I can see acf fields in V2 api for posts (/wp-json/wp/v2/posts) but not for categories and tags.

I have a multisite install and I also use bedrock https://roots.io/bedrock/
I'll try asap to replicate this issue in single install without bedrock.

And thanks @airesvsg for this great plugin

@vicocotea
Copy link

Just tried in another website without multisite and without bedrock.
And issues are still there.

So this not related to multisite and/or bedrock.

@adamwright32
Copy link

@airesvsg any update on this issue, @vicocotea are you using acf pro version as well?

@vicocotea
Copy link

@adamwright32 yes, pro version.

@vicocotea
Copy link

vicocotea commented Oct 4, 2017

I just tried with a wp basic install :

  • wp 4.8.2
  • twentyseventeen theme
  • acf 4.4.12
  • with or without acf pro 5.4.6

and still have the same issues (no v3 api call, no buttons in acf and acf fields in rest call for categories)

@vicocotea
Copy link

Humm sorry, I didn't see that v3 was on github not on wordpress plugin repository.
So I installed v3 (3.0.1-beta) and it works a lot better :)

I still not see the Settings button in plugins page. But I can now :

  • call the v3 api
  • see acf fields in taxonomy api calls
  • enable/disable Show/edit in rest api for each acf field

So I switch to v3 and hope the beta is pretty stable.

Thanks @airesvsg and sorry for the misunderstanding.
Maybe you can update the readme and/or publish the v3 on wordpress repository

@sebastienfi
Copy link

I migrated to WP 4.8.2 with ACF PRO and a lot of other plugins, and nothing broke with the latest version of acf-to-rest-api

@vicocotea
Copy link

Just looked a little bit more at this plugin (v3) maybe it can help.
Setting :
define('ACF_TO_REST_API_REQUEST_VERSION', 3);
hide the Settings button in plugin page.

@adamwright32
Copy link

@vicocotea did you get it working?

i have the settings available but when i go to "http://localhost:8888/wp-json/acf/v3/article"

i got the below and no data from fields

[{"id":2381,"acf":[]},{"id":1637,"acf":[]},{"id":909,"acf":[]}]

@vicocotea
Copy link

@adamwright32 Yes it works with v3.
What's article ?

I just had an issue with post_tag and used this solution #43

@airesvsg is it normal that I need this solution #43 in v3 (for post_tag/tags) ?

@adamwright32
Copy link

@vicocotea sorry i'm not sure what the fix is.

what do i need to do?

@adamwright32
Copy link

@vicocotea article is a custom post type, i have other ones and they all return without content

e.g http://localhost:8888/wp-json/acf/v3/ebook

[{"id":2693,"acf":[]},{"id":2692,"acf":[]},{"id":2691,"acf":[]},{"id":2690,"acf":[]},{"id":2689,"acf":[]},{"id":2688,"acf":[]},{"id":2687,"acf":[]}]

@vicocotea
Copy link

Sorry @adamwright32 I don't know. I just use posts, categories and tags.

@medinazdago
Copy link

medinazdago commented Jan 10, 2019

@adamwright32 try with:

//Adding post_types to wp-api rest
add_action( 'init', 'my_custom_post_type_rest_support', 25 );

function my_custom_post_type_rest_support() {

    global $wp_post_types;

//be sure to set this to the name of your post type!
    $post_type_name = 'your_post_type_name';

    if( isset( $wp_post_types[ $post_type_name ] ) ) {

        $wp_post_types[$post_type_name]->show_in_rest = true;
// Optionally customize the rest_base or controller class
        $wp_post_types[$post_type_name]->rest_base = $post_type_name;
        $wp_post_types[$post_type_name]->rest_controller_class = 'WP_REST_Posts_Controller';

    }

}

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

No branches or pull requests