How to get the URL of a sitemap that contains a certain post?

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; }

Scheduling doesn’t work due to caching?

wp_schedule_event is only run when your site is visited and the scheduled time has past. If varnish is serving a non expired cached page then your visitor is not hitting WordPress. Schedules a hook which will be executed by the WordPress actions core on a specific interval, specified by you. The action will trigger when … Read more

How do I serve fully cached full HTML on cloudfront

Yes, you can serve HTML through CloudFront as long as you don’t mind every user getting the same content until the cache expires. It completely depends how your caches are being stored. I can’t imagine a CDN that would not support this. They might not advertise it since many web sites are dynamic and can’t … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)