2

I am doing an IONIC app and the project requires to create a post through the Wordpress API with custom fields (I am using ACF Pro and Aires ACF to REST API), I can create a normal post with the REST API, even tho, the ACF fields are not created or asiggned, they are created for the post only if I create the post in Wordpress admin interface.

I was reading the documentation for the ACF to REST API , but I see only edit and show capabilities. Does that mean the post meta have to exist? So how to "create" them for the post

Thanks in advance for the help

Best regards

phpadmin post creating:

phpadmin post creating

absence of post meta:

absence of post meta

1 Answer 1

0
$json = file_get_contents('PATH/TO/FILE.json');
function the_json_contents($json_to_get){

            $json_in_array = json_decode($json_to_get, true); //json string to array

            return $json_in_array;
        }
function do_stuff_do_json() {
    $json_array = the_json_contents($json);
    foreach($json_array['id'] as $js) { //assuming we have an 'id' key
        $somevariable  = $js['someKey'];
        $somevariable2 = $js['someOtherKey'];
    } 

}

Refer this solution

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.