I have a custom table that I created named cars_plugin and it has columns id, name, color, model

Now, I can get list of cars using

$sql = "SELECT note FROM cars_plugin WHERE ID = '$id'"; 
$query = $wpdb->get_results($sql, ARRAY_A); 
foreach($query as $car){
   // list cars here

The above code works as planned, and I could create a pagination for that, although it will be difficult, now my question is, if I have a custom table like that how do I query the table so I can be able to use the built-in WordPress pagination functions?

Read more here: How to fetch posts with pagination feature in WP on a custom table?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: