WC_REST_Posts_Controller::prepare_links()
Prepare links for the request.
Метод класса: WC_REST_Posts_Controller{}
Хуков нет.
Возвращает
Массив
. Links for the given post.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_links( $post, $request );
- $post(WP_Post) (обязательный)
- Post object.
- $request(WP_REST_Request) (обязательный)
- Request object.
Код WC_REST_Posts_Controller::prepare_links() WC REST Posts Controller::prepare links WC 9.7.1
protected function prepare_links( $post, $request ) { $links = array( 'self' => array( 'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $post->ID ) ), ), 'collection' => array( 'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ), ), ); return $links; }