Generate custom XML sitemap on post save in WordPress

It’s not pretty, but it works. The script generates a custom XML sitemap on post save in WordPress. It’s looping through every page for every post with the post type “city” (since it’s unique content based on what city you choose). Remember to also use the URL parameter tool in Google Search Console to make the crawlers index the pages correctly. Since we use Polylang, the script will create a sitemap for each language.

Don’t forget to create the folder “sitemaps” in your theme folder and make it writable.

 

Modify ACF post object result to include Polylang language in WordPress admin

Modify the result in a ACF post object field in WordPress admin by including language slug from Polylang. Instead of having multiple object with the same title (but on different languages), add this to your functions.php. Don’t forget to change “field_name” to what ever your field is called.