Title: WordPress Inclusion
Last modified: August 19, 2016

---

# WordPress Inclusion

 *  818681
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/)
 * ok I have a simple yet frustrating problem.
 * I am currently coding a script which i want to do the following in:
    – Loop through
   an array of wp config files – Include the currently selected file – Do stuff –
   CLOSE THE SELECTED FILE/CONNECTION – Continue
 * My code is perfect and fine, the wordpress being included isn’t.
 * When I include the first one in the array, it will connect fine and do the “stuff”
   i specify. But when it gets to the second array entry, it includes the file but
   continues to use the first file’s connection.
 * I tried mysql_close and even unsetting $wpdb but no luck, wordpress just doesn’t
   want to be closed.
 * Its so simple yet WP makes it so complex and irritating.
 * If anyone can answer this I will be very greatful.
 * Thanks
    J

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/#post-824985)
 * dont close wordpress’ db connection.
 * use the new_link parameter when opening the second db connection.
 * [http://us.php.net/function.mysql-connect](http://us.php.net/function.mysql-connect)
 *  Thread Starter 818681
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/#post-824999)
 * well I can’t because im simply including the wordpress’ config file.
 * It works perfect until it tries including another file.
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/#post-825008)
 * well youre going to have to elaborate on what you are trying to do. What you 
   describe above isnt enough.
 *  Thread Starter 818681
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/#post-825022)
 * ok
 * I have a custom script, I include wp-config.php INTO that script (include “wp-
   config.php”) but from an array.
 * e.g.
 * $array = array(“wp-config.php”,”anotherwp-config.php”);
    foreach($array as $value){
   include $value; // Do stuff // somehow close the current wordpress connection}
 * But as it is now, when the second config is included, the first connection is
   still used, not the second.
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/#post-825023)
 * dunno cant help you, and dont understand why you are including configuration 
   files like that. But whatever..

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WordPress Inclusion’ is closed to new replies.

## Tags

 * [close](https://wordpress.org/support/topic-tag/close/)
 * [exit](https://wordpress.org/support/topic-tag/exit/)
 * [frustration](https://wordpress.org/support/topic-tag/frustration/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [whooami](https://wordpress.org/support/users/whooami/)
 * Last activity: [17 years, 9 months ago](https://wordpress.org/support/topic/wordpress-inclusion/#post-825023)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
