Title: Dynamic path to settings.xml/settings.php when running embedded
Last modified: August 30, 2016

---

# Dynamic path to settings.xml/settings.php when running embedded

 *  Resolved [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/)
 * Hello!
 * We run Types embedded in some of our themes because of a multi user-setup.
    This
   is because the sites use the same theme, but with separate uploads-folders and
   databases.
 * To do this, we follow the instructions of copying the embedded-folder into the
   theme.
 * But as we keep our plugins automatically updated with composer in the plugins
   directory we would like to include the embedded-folder directly instead of “detaching”
   the embedded files.
 * By “detaching” i mean that we move the emdedded folder out of the plugins-folder
   that is automatically updated from the WordPress-repository.
 * As far as i can see this in itself is not a problem, but we would like to keep
   the settings.php and settings.xml-files in a separate versioned folder. For example
   these files could be kept in a folder in the theme.
 * Basically there should be an option to specify where the config-files are located
   when embedding Types.
 * The lines that are affected:
    embedded/functions.php:125 embedded/functions.php:
   136 embedded/functions.php:144
 * A proposal would be to do like this:
 * Create a extra constant that falls back to “WPCF_EMBEDDED_ABSPATH”.
 *     ```
       if ( file_exists( WPCF_EMBEDDED_ABSPATH . '/settings.php' ) ) {
   
               if(!defined('WPCF_EMBEDDED_CONFIG_ABSPATH'))
               {
                   define('WPCF_EMBEDDED_CONFIG_ABSPATH', WPCF_EMBEDDED_ABSPATH);
               }
   
               require_once WPCF_EMBEDDED_ABSPATH . '/admin.php';
               require_once WPCF_EMBEDDED_CONFIG_ABSPATH . '/settings.php';
               $dismissed = get_option( 'wpcf_dismissed_messages', array() );
               if ( in_array( $timestamp, $dismissed ) ) {
                   return false;
               }
               if ( $timestamp > get_option( 'wpcf-types-embedded-import', 0 ) ) {
                   if (
                       isset( $_GET['types-embedded-import'] )
                       && isset( $_GET['_wpnonce'] )
                       && wp_verify_nonce( $_GET['_wpnonce'], 'embedded-import')
                   ) {
                       if ( file_exists( WPCF_EMBEDDED_CONFIG_ABSPATH . '/settings.xml' ) ) {
                           $_POST['overwrite-groups'] = 1;
                           $_POST['overwrite-fields'] = 1;
                           $_POST['overwrite-types'] = 1;
                           $_POST['overwrite-tax'] = 1;
                           $_POST['post_relationship'] = 1;
                           require_once WPCF_EMBEDDED_INC_ABSPATH . '/fields.php';
                           require_once WPCF_EMBEDDED_INC_ABSPATH . '/import-export.php';
                           $data = @file_get_contents( WPCF_EMBEDDED_CONFIG_ABSPATH . '/settings.xml' );
                           wpcf_admin_import_data( $data, false, 'types-auto-import' );
                           update_option( 'wpcf-types-embedded-import', $timestamp );
                           wp_safe_redirect( esc_url_raw(admin_url() ));
                       } else {
                           $code = __( 'settings.xml file missing', 'wpcf' );
                           wpcf_admin_message( $code, 'error' );
                       }
                   }
       ```
   
 * This would be great as the developer could specify the placement of the config-
   files himself, but by default it looks for the config-files in embedded folder.
 * Hope to hear from you, all feedback is appreciated 🙂
    Creds to you for a very
   nice plugin and WP Toolset! Best regards, Robert Sather. [https://wordpress.org/plugins/types/](https://wordpress.org/plugins/types/)

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

 *  Thread Starter [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778265)
 * Bump
 *  Thread Starter [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778319)
 * Bump
 *  Thread Starter [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778321)
 * Bump
 *  [Jan Štětina](https://wordpress.org/support/users/jans-1/)
 * (@jans-1)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778324)
 * Hello Robert Sather, I’m very sorry for the late reply.
 * Can you please post this to our Toolset support forum [https://wp-types.com/forums/forum/support-2/](https://wp-types.com/forums/forum/support-2/)?
   Unfortunately we can’t handle complex feature requests here.
 *  Thread Starter [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778328)
 * I’m sorry, i am not a paying customer. Is there any other way to contact you 
   guys about this proposed edit?
 *  Plugin Author [Jan Štětina](https://wordpress.org/support/users/zaantar/)
 * (@zaantar)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778329)
 * I see. We have a free forum as well, although I am not sure if it would make 
   a difference in this case… please hold on a little longer, I will see what can
   I do about this. 🙂
 *  Thread Starter [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778330)
 * Thank you **very** much! 🙂
 *  Anonymous User 14808221
 * (@anonymized-14808221)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778331)
 * You can post this Feature request in the [Free Forum](https://wp-types.com/forums/forum/general-and-pre-sales-questions/)
   for Types.
 * You can register for free [here](https://wp-types.com/support/register/).
 * Then, a Supporter will escalate your request and the DEV will evaluate whether
   or not to implement this feature.
 * Thank you for your cooperation!
 *  Plugin Author [Jan Štětina](https://wordpress.org/support/users/zaantar/)
 * (@zaantar)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778332)
 * Beda, thank you for the clarification! In this case, however, I think we can 
   escalate this directly, it is a small change without side-effects, and it makes
   good sense.
 *  Thread Starter [Robert S.](https://wordpress.org/support/users/robsat91/)
 * (@robsat91)
 * [10 years ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778343)
 * Hello again!
 * I can see that this has now been implemented.
    Thank you very much for great 
   support. Hopefully other people will take use of this functionality as well.
 * Have a nice day!

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

The topic ‘Dynamic path to settings.xml/settings.php when running embedded’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/types_ced1d3.svg)
 * [Toolset Types - Custom Post Types, Custom Fields and Taxonomies](https://wordpress.org/plugins/types/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/types/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/types/)
 * [Active Topics](https://wordpress.org/support/plugin/types/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/types/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/types/reviews/)

 * 10 replies
 * 4 participants
 * Last reply from: [Robert S.](https://wordpress.org/support/users/robsat91/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/dynamic-path-to-settingsxmlsettingsphp-when-running-embedded/#post-6778343)
 * Status: resolved