I have an external PHP script that does a lot of back end processing for a website. I need for this PHP script to query, insert, and delete various links from the XML Sitemap.

I want to use XMLSitemap's API instead of raw SQL so any additional functionality that needs to happen on inserts and deletes are called, like any alter hooks, etc.

I don't want to bog down the website for this processing, hence why I need to do this from a back-end script.


You'll need to bootstrap the Drupal environment in your PHP script to do this. There are many ways to do this, probably the easiest is Drush's php-script command:

drush php-script my_custom_script.php

This will let you execute any arbitrary PHP script in a bootstrapped Drupal environment.

Once you have your script running your Drupal environment, you can utilize the XMLSitemap API functions for all your CRUD operations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.