Y
Y
Yury Bondaruk2021-09-08 22:40:31
PHP
Yury Bondaruk, 2021-09-08 22:40:31

How to get strings from an array in PHP via WP-JSON?

Hello! Wordpress Rest API comes with such an array, how to get specific values ​​of all 'guid' values ​​from this array? PHP uses the following code

register_rest_field( 'post', 'AttachedImages', array(
  'get_callback' => function ( $data ) {
    $postID = $data['id'];
    $attached_file = get_attached_media('',$postID);
    return $attached_file;
  }, ));


ahfJv-3OR8s.jpg?size=686x878&quality=96&sign=61865ed315629cbddc3496d168b0df46&type=album

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question