Due to the lack of answers here, I had to find a way to make this happen so I ended up simply adding it to the standard REST like so:
function save_custom_meta_from_rest( $post, $request, $creating ) {
$params = $request->get_json_params();
if ( isset( $params['observacao_intensidade_ataque'] ) ) {
update_post_meta( $post->ID, 'observacao_intensidade_ataque', sanitize_text_field( $params['observacao_intensidade_ataque'] ) );
}
if ( isset( $params['observacao_incidencia_doenca_parcela'] ) ) {
update_post_meta( $post->ID, 'observacao_incidencia_doenca_parcela', sanitize_text_field( $params['observacao_incidencia_doenca_parcela'] ) );
}
}
add_action( 'rest_insert_observacao', 'save_custom_meta_from_rest', 10, 3 );
Hope this helps future people with the same problem.
I just have now to put these two fields outside “acf” and that’s it.
Fun fact: although everything indicated that the problem was with ACF PRO, actually it was bad requests from Theme Options page for the theme we are using.
We have made a workaround for this, since the loading of that theme options was always happening and was consuming almost 5/7secs only for that, we though in removing it, putting a direct link in admin bar and the entire wp-admin is now really fast, although we have a LOT custom fields (probably more than 200) and a lot plugins, we could optimize the code in order to have loading times never superior to 2secs. 🙂
Uff, this was very celabrated here in my company! Hehe. 🙂
Thank you anyway.
This is indeed something and I congratulate you for that, now the next step is doing this but dynamicaly and integrated with ACF.
Come on ACF team, you have already a good part done, now it’s up to you to integrate it! 🙂
Or, someone can do a plugin for that… just an idea! 😉
Any solution for this problem? I’m still stuck with this… 🙁
Yup, there it was:
[12-Jun-2016 19:57:05 UTC] AND wp_posts.post_type = 'property' AND ((wp_posts.post_status <> 'trash' AND wp_posts.post_status <> 'auto-draft')) AND ( ( t.language_code = 'pt-pt' AND wp_posts.post_type IN ('post','page','acf-field-group','acf-field','property','testimonial' ) ) OR wp_posts.post_type NOT IN ('post','page','acf-field-group','acf-field','property','testimonial' ) )wp_posts.post_date DESCLIMIT 40, 20 JOIN wp_icl_translations t
ON wp_posts.ID = t.element_id
AND t.element_type = CONCAT('post_', wp_posts.post_type) INNER JOIN wp_postmeta as METACF ON (wp_posts.ID = METACF.post_id)
[12-Jun-2016 19:57:05 UTC] AND wp_posts.post_type = 'property' AND ((wp_posts.post_status <> 'trash' AND wp_posts.post_status <> 'auto-draft')) AND ( ( t.language_code = 'pt-pt' AND wp_posts.post_type IN ('post','page','acf-field-group','acf-field','property','testimonial' ) ) OR wp_posts.post_type NOT IN ('post','page','acf-field-group','acf-field','property','testimonial' ) )wp_posts.post_date DESC JOIN wp_icl_translations t
ON wp_posts.ID = t.element_id
AND t.element_type = CONCAT('post_', wp_posts.post_type)
And this is doing a query with the word “test”, which should return at least 4 results and it returns only the first one:
[12-Jun-2016 20:06:27 UTC] AND (((wp_posts.post_title LIKE '%test%') OR (wp_posts.post_excerpt LIKE '%test%') OR (wp_posts.post_content LIKE '%test%') OR (METACF.meta_key = 'estate_property_id' AND CAST(METACF.meta_value AS CHAR) LIKE '%test%'))) AND wp_posts.post_type = 'property' AND ((wp_posts.post_status <> 'trash' AND wp_posts.post_status <> 'auto-draft')) AND ( ( t.language_code = 'pt-pt' AND wp_posts.post_type IN ('post','page','acf-field-group','acf-field','property','testimonial' ) ) OR wp_posts.post_type NOT IN ('post','page','acf-field-group','acf-field','property','testimonial' ) )wp_posts.post_date DESCLIMIT 0, 20 JOIN wp_icl_translations t
ON wp_posts.ID = t.element_id
AND t.element_type = CONCAT('post_', wp_posts.post_type) INNER JOIN wp_postmeta as METACF ON (wp_posts.ID = METACF.post_id)
I had actually tried that before but I cannot get any kind of output in any log. Maybe I am doing it wrong, but I actually don’t know where should I put that error_log.
Should I put it inside some ACF file? I have no idea whatsoever…
I thank you for your answer, but that’s exactly the same hook that I am using.
Please notice that I am using two different hooks, one for the result, that only adds a custom field to the title and that’s working perfectly, and the other for the query which is done with the same hook you said.
It is definitely a MUST HAVE! 🙁
I am also interested in knowing if a solution was ever found for this.
This is why I ALWAYS edit my questions whenever I find an answer. 🙂
For future reference, I am using WPML and I have added this Relationship field after installing WPML, so I had to went back to WPML > Translation options and hit “Save” on “Custom posts”.
That’s it, it’s working perfectly. 🙂
Well, I have already submited a ticket months ago regarding other subject and I never got any answer, so let’s see if this time someone answers this ticket…
This simply makes no sense that nobody is doing this and it’s such a long time since the first feature request with so many people all over the web asking for the feature…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.