You could try something like:
$url="https://oc.com/api/v1/employees/?page=1";
$data = array();
while ( $url ) {
$response = $this->request( $url );
$data = array_merge( $data, $response->data );
// if this is not the last page, get the next page URL
if ( $response->paginator->current_page != $response->paginator->last_page ) {
$url = $response->paginator->next_page;
} else {$url = false;}
}
return $data;
Related Posts:
- What is This esc_html_e() i wordpress php?
- Build a content and excerpt grid loop with paging and options for # of posts
- Displaying post per day
- How to add active class to custom menu using while loop and wp_list_pages
- delete an array element when its date expires
- How can I loop into two different DIVS without repeating the DIVs
- How to speed up a wordpress function with multiple loops?
- Custom excerpt function re-factoring
- Get first URL from post content
- Show css depending on activity type in BuddyPress activity-loop [closed]
- get author_name from queried post
- Blog posts repeat
- how to refresh div on template part?
- Can’t find infinite loop cause
- Checking array against author id in loop
- Custom Pagination is Broken
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- use loop to return blog details
- How to get current post category details inside “loop”?
- Calling function in loop causes repeat data
- Strip from or something better?
- How to Add a cutsom slug to my custom author role
- Products listing check if meta checkbox is checked
- How to output the taxonomies that are assigned to each custom post?
- update_user_meta as multiple value but with same meta key
- WordPress Ajax filter: Create two loops for different output styles?
- How can I get my pagination loop to display the correct number of total pages?
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- How fix error in the WordPress loop?
- My query keeps looping infinitely ! how to stop it?
- Retrieving specific images from Media Library
- Modify category archive page loop on functions.php
- Pagenav Not appearing on custom Template
- Options.php loop won’t show!
- Loop on a wordpress Page instead of content coming from the WP text editor
- start_lvl Ignored in Custom walker_nav_menu
- Enforcing password complexity
- Check if a menu is empty?
- Dynamically change feature image in customiser
- Creating wordpress user registration form
- Get the title before comma
- category not display in word press grammatically
- Custom post type loops with different page templates
- Getting a fatal error while updating
- Display 4 chronological posts starting with a random post
- get understrap pagination to work with custom query
- my function doesn’t return my post from today
- How to break down importing of feeds
- Way to display “Yesterday”, “Today”
- get_the_terms – only top level
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Use wp_get_recent_posts with search term
- multiple if statements [closed]
- comments_number display outside specified span
- Choose To Display Post Views With An Options Panel
- Prevent Data Resubmission On Page refresh
- Passing the custom field values in the wp_get_current_user array function
- Get value from shortcode to do something
- PHP 8, AJAX mail form to function.php doesn’t work
- Ajax request not sending to server and returning – wp-admin/admin-ajax.php 400
- How to create a php variable using WordPress the_title() function
- How to set variable, pass it to a partial file and remove it after?
- how to make custom ajax handler?
- How to disable controls in theme customizer?
- is there a benefit in using a constant over get_stylesheet_directory_uri?
- ::before on open/close function [closed]
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- How to check if a PHP string is different than meta field?
- Loop increase number
- How to loop through all the attached images in a post, and get their url one by one
- Creating a mobile site by adding a new class to the body tag from functions.php
- Show recent posts starting at a specific number archive
- Issue with fetching mysql data and displaying results via shortcode in webpage
- Noindex Posts From Certain Authors In WordPress
- Issue with custom loop in Archive page
- Show all tags within a category?
- WP Query Leads to 502 Bad Gateway (Timeout Because Query Takes Too Long)
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- WordPress call post-ID in jquery
- How can I alter this code to accept a slug as well as an ID?
- Enqueueing a code block from an options framework
- List all anchor links on a page
- Auto create Nextgen Gallery on post creation [closed]
- Hide media for non logged in users
- Adding an “Upgrade Subscription” button to an Elementor page
- Custom function that re-writes page title breaks when the Yoast plugin is activated
- Hide payment method based on user role AND minimum cart value
- How do if all posts has this category ID then do this
- View tag description on page
- WP HTTP API call response
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Private messaging – Getting and displaying the avatar/url of a message recipient
- Display product attributes for current product
- How can I put a custom field as the link of a button shortcode?
- Fix My Custom Function: Remove Automatic
- WP Debug enabled Undefined index error in a widget
- is there away to hide php code in wordpress not to show in PAGES
- Understanding responsive imagery
- Tags being Inserted in html from plugin PHP not passing through the_content