• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

how to make paging for this custom rest API?

I used this to get best selling product from woocommerce and return the product data in REST API

but i need to make a pagination system so user can define witch page must show.

function featureproduct(){ $prdtc=wc_get_featured_product_ids(); $array=array(); $i=0;     foreach ($prdtc as $id)     {         $res = wc_get_product( $id);         $array[$i]=array( $id,  $res->get_name(), $res->get_price(), get_the_post_thumbnail_url($id), get_permalink($id) );     $i++; }     echo json_encode($array,JSON_FORCE_OBJECT); } 

I need something like that wp-json Used for example:

/wp-json/wc/v3/products?per_page=10&page=1 
Download script demo [LINK]
Download script demo [LINK 2] Download script demo [LINK 2]