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.

 

Disable payment gateway for specific user role in WooCommerce

Disable a specific payment gateway in WooCommerce by adding this to your custom plugin or function.php in your theme. You can also add multiple user roles with the plugin Members and change payment gateway for different roles.