Title: External Database
Last modified: December 21, 2018

---

# External Database

 *  Resolved [max1024](https://wordpress.org/support/users/max1024/)
 * (@max1024)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/)
 * Hello
    Is there some way to share pods tables between different sites? like I
   would like to put whole pods tables/stuff into database, separated from wordpress
 * Thank you

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

 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11016847)
 * It’s a great idea, I think it would be possible by filtering the table name we
   use, see below:
 *     ```
       add_filter( 'pods_api_get_table_info', 'my_custom_pods_table_location' );
   
       /**
        * Filter the table location for your Pod.
        *
        * @param array $table_info Table info configuration.
        *
        * @return array
        */
       function my_custom_pods_table_location( $table_info ) {
           if ( 'pod' === $table_info['type'] && 'my_act_pod' === $table_info['object_name'] ) {
               $table_info['table']      = 'some_other_table_name';
               $table_info['meta_table'] = $table_info['table'];
           }
   
           return $table_info;
       }
       ```
   
 * There’s an example where I have an Advanced Content Type pod named “my_act_pod”
   and I’m filtering the table we use in Pods. This table, when you create the pod
   and modify it, will get it’s table columns modified. So be sure you have the 
   Pod set up the way you want it in all the places you want first before adding
   the table name filter.
    -  This reply was modified 7 years, 5 months ago by [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/).
 *  Thread Starter [max1024](https://wordpress.org/support/users/max1024/)
 * (@max1024)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11016886)
 * Hi
    Thank you for reply, but I dont get an idea. Say, my wordpress database is
   located on localhost, but my pods database is located somwhere else (somehost:
   port) How shell I configure the PODs, to let them walk into another MySQL instance?
   I am not so strong in WP…
 * Thank you
    -  This reply was modified 7 years, 5 months ago by [max1024](https://wordpress.org/support/users/max1024/).
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11016958)
 * That won’t work here. What you can do is set the table name to use another database
   the current MySQL user has access too though. For instance, if your WordPress
   sites are on their own databases, but the MySQL user has access to a “custom_data”
   database, you can set the table to be `custom_data.some_other_table_name` and
   it will access the data on that other database — pretty cool!
 * Sorry about not being able to reference data on another MySQL connection, that’s
   something we don’t have the ability to do at all within Pods or WP when mixing
   data and queries.
 * Now, if you want to add a **relationship** to that data, but you don’t need to
   query that data from the Pods context, you can definitely do that with custom
   relationship objects:
 *     ```
       add_action( 'pods_form_ui_field_pick_related_objects_other', 'my_custom_pods_relationships' );
   
       /**
        * Register your custom relationship object.
        */
       function my_custom_pods_relationships() {
       	PodsField_Pick::$related_objects['my_custom_relationship'] = array(
       		'label'         => 'My custom relationship object',
       		'group'         => __( 'Advanced Objects', 'pods' ),
       		'simple'        => true,
       		'data_callback' => 'my_custom_pods_relationship_data',
       	);
       }
   
       /**
        * Data callback for your custom relationship object.
        *
        * @param string       $name    The name of the field.
        * @param string|array $value   The value of the field.
        * @param array        $options Field options.
        * @param array        $pod     Pod data.
        * @param int          $id      Item ID.
        *
        * @return array
        */
       function my_custom_pods_relationship_data( $name = null, $value = null, $options = null, $pod = null, $id = null ) {
       	$data = array();
   
       	// Set up your own Database WPDB connection or call the API you want.
       	// Add data in this format: $data['key'] = 'Label';
   
       	return $data;
       }
       ```
   
    -  This reply was modified 7 years, 5 months ago by [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/).
    -  This reply was modified 7 years, 5 months ago by [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/).
 *  Thread Starter [max1024](https://wordpress.org/support/users/max1024/)
 * (@max1024)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11017107)
 * Thanks for reply
    What about FEDERATE tables? Will it works with Pods?
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11017299)
 * It’s possible, but it’s never been tested. Let us know how it goes 🙂
 *  Plugin Author [Scott Kingsley Clark](https://wordpress.org/support/users/sc0ttkclark/)
 * (@sc0ttkclark)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11017303)
 * If you get it working, bonus points if you can provide a tutorial on how to do
   that kind of setup, it would be really cool to show our users how to get that
   to work.
 *  Thread Starter [max1024](https://wordpress.org/support/users/max1024/)
 * (@max1024)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11024800)
 * Hi
    ok I will try both ways and post the results here
 *  Thread Starter [max1024](https://wordpress.org/support/users/max1024/)
 * (@max1024)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11024930)
 * Hello
    looks like it is not so easy when I go with first approach Ive got ` WordPress
   database error: [Table 'wordpress_database.my_storage.wps_pods_test' doesn't 
   exist]  Looks like a WP databasename was added before my custom database name
   as well brief look through code doesnt ring the bell
 * Maxim
 *  Thread Starter [max1024](https://wordpress.org/support/users/max1024/)
 * (@max1024)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11032572)
 * Hello
    Ive played with FEDERATE (CONNECT actually) got some results But I feel
   that place could be uncomfortable to discuss it any suggestions? Thank you

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

The topic ‘External Database’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [max1024](https://wordpress.org/support/users/max1024/)
 * Last activity: [7 years, 5 months ago](https://wordpress.org/support/topic/external-database-6/#post-11032572)
 * Status: resolved