Background of the issue:
Similar to what I reported (and was fixed) in https://wpml.org/forums/topic/icl_string_positions-position_in_page-should-be-relative/
You cannot store absolute paths, full URLs or paths/URLs that include WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_PLUGIN_URL,... in an option.
icl_sitepress_settings option:
...s:22:"theme_language_folders";a:1:{s:6:"parent";s:74:"/redacted/path/to/wp-content/theme/content/framework/languages";}...
Additionally, by saving the wp-content/theme path, this will break when WP_CONTENT_DIR,... constants are changed in wp-config. You should only store the theme path and build it dynamically when using it.
Same issue for these 2 options:
wcml_currency_switcher_template_objects
wpml_disabled_switcher_template_objects
Here additionally, you also store full URLs, which means it will break when the domain is changed and also for the above WP_CONTENT_DIR case too, as well as obviously for when the absolute path/ABSPATH changes.
'wpml_disabled_switcher_template_objects','a:6:{s:20:"wpml-legacy-dropdown";a:12:{s:4:"path";a:2:{i:0;s:101:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers";i:1;s:117:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/legacy-dropdown";}s:7:"version";s:1:"1";s:4:"name";s:8:"Dropdown";s:4:"slug";s:20:"wpml-legacy-dropdown";s:8:"base_uri";s:118:"hidden link";s:3:"css";a:2:{i:0;s:127:"hidden link";i:1;s:131:"hidden link";}s:2:"js";a:2:{i:0;s:127:"hidden link";i:1;s:131:"hidden link";}s:14:"flags_base_uri";N;s:14:"flag_extension";N;s:7:"is_core";b:1;s:3:"for";a:2:{i:0;s:8:"sidebars";i:1;s:17:"shortcode_actions";}s:14:"force_settings";a:1:{s:29:"display_link_for_current_lang";i:1;}}s:26:"wpml-legacy-dropdown-click";a:12:{s:4:"path";a:2:{i:0;s:101:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers";i:1;s:123:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/legacy-dropdown-click";}s:7:"version";s:1:"1";s:4:"name";s:14:"Dropdown click";s:4:"slug";s:26:"wpml-legacy-dropdown-click";s:8:"base_uri";s:124:"hidden link";s:3:"css";a:2:{i:0;s:133:"hidden link";i:1;s:137:"hidden link";}s:2:"js";a:2:{i:0;s:133:"hidden link";i:1;s:137:"hidden link";}s:14:"flags_base_uri";N;s:14:"flag_extension";N;s:7:"is_core";b:1;s:3:"for";a:2:{i:0;s:8:"sidebars";i:1;s:17:"shortcode_actions";}s:14:"force_settings";a:1:{s:29:"display_link_for_current_lang";i:1;}}s:27:"wpml-legacy-horizontal-list";a:12:{s:4:"path";a:2:{i:0;s:101:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers";i:1;s:124:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/legacy-list-horizontal";}s:7:"version";s:1:"1";s:4:"name";s:15:"Horizontal List";s:4:"slug";s:27:"wpml-legacy-horizontal-list";s:8:"base_uri";s:125:"hidden link";s:3:"css";a:2:{i:0;s:134:"hidden link";i:1;s:138:"hidden link";}s:2:"js";a:0:{}s:14:"flags_base_uri";N;s:14:"flag_extension";N;s:7:"is_core";b:1;s:3:"for";a:3:{i:0;s:8:"sidebars";i:1;s:6:"footer";i:2;s:17:"shortcode_actions";}s:14:"force_settings";a:0:{}}s:25:"wpml-legacy-vertical-list";a:12:{s:4:"path";a:2:{i:0;s:101:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers";i:1;s:122:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/legacy-list-vertical";}s:7:"version";s:1:"1";s:4:"name";s:13:"Vertical List";s:4:"slug";s:25:"wpml-legacy-vertical-list";s:8:"base_uri";s:123:"hidden link";s:3:"css";a:2:{i:0;s:132:"hidden link";i:1;s:136:"hidden link";}s:2:"js";a:0:{}s:14:"flags_base_uri";N;s:14:"flag_extension";N;s:7:"is_core";b:1;s:3:"for";a:3:{i:0;s:8:"sidebars";i:1;s:6:"footer";i:2;s:17:"shortcode_actions";}s:14:"force_settings";a:0:{}}s:29:"wpml-legacy-post-translations";a:12:{s:4:"path";a:2:{i:0;s:101:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers";i:1;s:126:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/legacy-post-translations";}s:7:"version";s:1:"1";s:4:"name";s:17:"Post translations";s:4:"slug";s:29:"wpml-legacy-post-translations";s:8:"base_uri";s:127:"hidden link";s:3:"css";a:2:{i:0;s:136:"hidden link";i:1;s:140:"hidden link";}s:2:"js";a:0:{}s:14:"flags_base_uri";N;s:14:"flag_extension";N;s:7:"is_core";b:1;s:3:"for";a:1:{i:0;s:17:"post_translations";}s:14:"force_settings";a:0:{}}s:14:"wpml-menu-item";a:12:{s:4:"path";a:2:{i:0;s:101:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers";i:1;s:111:"/redacted/path/to/wp-content/plugins/sitepress-multilingual-cms/templates/language-switchers/menu-item";}s:7:"version";s:1:"1";s:4:"name";s:9:"Menu Item";s:4:"slug";s:14:"wpml-menu-item";s:8:"base_uri";s:112:"hidden link";s:3:"css";a:2:{i:0;s:121:"hidden link";i:1;s:125:"hidden link";}s:2:"js";a:0:{}s:14:"flags_base_uri";N;s:14:"flag_extension";N;s:7:"is_core";b:1;s:3:"for";a:1:{i:0;s:5:"menus";}s:14:"force_settings";a:0:{}}}','auto');
Symptoms:
I expected to see relative paths, but instead, I got absolute paths stored in options, which can break when certain constants or domains change.
Questions:
Why are absolute paths being stored in options instead of relative paths?
How can I ensure that paths are stored correctly to avoid issues when constants or domains change?