I achieved it using this simple query
<?php
$chunks=array_chunk(
get_posts([
'fields'=>'ids',
'posts_per_page'=>-1,
'post_type'=>[$post->post_type],
'orderby'=>'ID',
'order'=>'ASC'
]),
wp_sitemaps_get_max_urls('post')
);
foreach($chunks as $key => $chunk) {
if(!in_array($post->ID,$chunk)) continue;
var_dump(get_sitemap_url('posts',$post->post_type,$key + 1));
break;
}
Related Posts:
- W3 total cache – cache refresh programmatically [closed]
- Should I use Transient API to store HTML String, or Object?
- Caching: APC vs APCu vs OPcache
- Best way to show Dynamic Content on a Cached WordPress Site?
- Prevent WordPress from sending Cache-control http header
- Optimize apache for WP use
- Does a query executed through wpdb class get cached?
- Caching: Force fresh content for logged-in users (potentially by adding a query variable to the URL)
- Multiple WordPress sites eat up alot of RAM
- What exactly is an advanced object cache?
- Using a wildcard with delete_transient()
- wp_cache_set() or wp_cache_add()
- How to purge all transient caches?
- Writing a cache manifest file for a WordPress blog (app cache, offline web applications)
- How to force content refresh of a page that has been loaded previously by the user? [closed]
- Help Pinpointing Source of Caching Issue
- Want to enforce the visitor to load the new version of your stylesheets and scripts [closed]
- Can someone explain WordPress caching, and what’s the best in my scenario?
- Transient / object cache maximum key length [duplicate]
- APC object caching in combination Batcache/memcached page caching?
- WordPress caching in development
- What is difference between ‘Page Cache’ and ‘Object Cache’ in WordPress?
- W3 total Cache – Site with query strings
- Programmatically insert hierarchical terms & set terms for post causes glitch? [duplicate]
- Will caching WordPress affect session variables, custom filed updates and displaying images from a non wordpress table?
- Getting soft 404 errors (200 status) when caching plugins are enabled
- How to totally disable cache in WordPress?
- Automatically enabled caching in some hosting companies w/o visible plugin (Must use plugin)
- How to purge all transient caches?
- W3 Total Cache plugin integration
- server load. $_SERVER[‘REMOTE_ADDR’] and $_SERVER[‘HTTP_HOST’] [closed]
- Execute a piece of code also when the cached version of a page is served
- Method to make definitively static an abandoned WP blog
- pass-protected pages and posts not protected after enter them 1 time
- Can a WordPress blog be entirely hosted on a CDN if cached?
- Static HTML page caching for large website [closed]
- To have WordPress interact with memcached it must be installed as a PHP extension?
- WordPress caching issue
- WP Super Cache Bug with Ubermenu
- Problem with caching, W3TC [closed]
- Reasonable Size Limit to options entry
- Is the object cached?
- How to find time last viewed?
- WP Rocket Cache Lifespan – Never clear cache? [closed]
- Disable feed cache for custom RSS feed?
- How do I enable dynamic content in a theme cached with WP Super Cache?
- How to cache a different page version based on HTTP header?
- How to store or cache custom shopping cart data for every user’s session
- Live website is not showing the changes I’ve made [closed]
- Hook an action when a transient is deleted ? Can’t get it to work!
- w3 total cache and sitemap.xml
- Accelerate and clean up WordPress [closed]
- WebHostingBuzz cache statement
- W3 Total Cache can’t create files [closed]
- Files cached as CSS or PHP?
- A bunch of unrelated wordpress using same memcached don’t store correctly their datas
- RSS: fetch_feed caching with different caching delay per feed?
- How to be sure to get last page version without ANY cache?
- Is there a limit to size of data stored in update_option()?
- Last-Modified header support doesnât speed up server processing – want more
- HIgh CPU usage – Will using cache plugins help
- Browser cache for dynamic content (list of tags)
- Jetpack stats and caching strategy [closed]
- How to specify expiration of cacheable resources? [closed]
- How do I serve fully cached full HTML on cloudfront
- APC fragmention woes on Apache AWS EC2 Small instance with WordPress and W3TC [closed]
- w3 total cache – Object Caching 2165/2469 objects? [closed]
- Website working fine when logged in but not working fine when we logged out
- Get user name and caching system
- Changing WP Object Caching during runtime
- How to solve simple wp simple ajax chat caching problem
- dynamic page not displaying correctly when Varnish hosting ignores query string parameters
- What do I do if my WordPress site is suddenly sanitizing portions of URLs it shouldn’t?
- WordPress mobile version is not responsive anymore after installing varnish
- Admin area is caching posts in the editor
- Clear cache when comment is added
- WordPress varnish pages printed twice
- Feed cache fallback – A feed could not be found
- WordPress Userroles button getting cached
- custom php file inside my custom folder of plugins directory is not caching
- How to let users clear their posts cache with WP Super Cache?
- Having 4000 posts, my site is so slow
- Super cache caches mobile pages for desktop
- Should I use transients for these API call results?
- cache reset button and question about deleting cache
- Cleared wp-cache and file is still not updated [closed]
- Bluehost WebHost and performance problems with W3TC [closed]
- W3 Total Cache Minification: way to revert back? [closed]
- get_theme_mod returning cached values regardless of apache restart
- Caching with dynamic content
- After Migration, Warning: include_once() errors on all pages
- Server Variables not recognized in certain posts
- Levels of caching and impact on the WordPress web site
- CSS changes not taking effect [closed]
- Experiencing a weird caching issues without any caching plugins
- How I define max cache time to Google Fonts installed on my site
- Cannot add version of main.css to wordpress on testing enviroment
- Cache a number of responses from external json feeds?
- How to create a transient that persists the data for the whole duration of the expiration, even when object cache is enabled?
- Why does enabling caching break password protected pages? Is there a way around this?