Script to generate pages – taxonomies not loaded
I’ve created a basic script in my wordpress root folder as a temporary file to generate a batch of new posts.
I’ve included the line:
As I’ve done in the past.
I’m encountering problems that certain taxonomies are not seemingly available in this PHP script when calling e.g.
$productterms = get_terms( array( 'taxonomy' => 'product-type', 'parent' => 0 ) );
I get a response of invalid-taxonomy.
The taxonomy name is definitely correct and this call to retrieve the terms works in functions.php.
I suspect I have a load order issue – but can anyone suggest how to work around this? Essentially I just need to have a PHP script that will allow me to loop through an array I’ve compiled to create pages based on that data – but I need the various taxonomies loaded/available to use.