embed_links example

if ( ! empty( $links ) ) {
            // Convert links to part of the data.             $data['_links'] = $links;
        }

        if ( $embed ) {
            $this->embed_cache = array();
            // Determine if this is a numeric array.             if ( wp_is_numeric_array( $data ) ) {
                foreach ( $data as $key => $item ) {
                    $data[ $key ] = $this->embed_links( $item$embed );
                }
            } else {
                $data = $this->embed_links( $data$embed );
            }
            $this->embed_cache = array();
        }

        return $data;
    }

    /** * Retrieves links from a response. * * Extracts the links from a response into a structured hash, suitable for * direct output. * * @since 4.4.0 * * @param WP_REST_Response $response Response to extract links from. * @return array Map of link relation to list of link hashes. */
Home | Imprint | This part of the site doesn't use cookies.