Import Settings broken, many values ignored
- [x] I've read and understood the contribution guidelines.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened.
When exporting and importing settings, a lot of imported settings are not applied
Please describe what you expected to happen and why.
Expect all imported settings to be applied
How can we reproduce this behavior?
- have some settings set, like:
Search Appearance > General > Organization Name - export settings
- import into a different setup, or change orginal setting values before re-importing to same install
- verify the setting is not imported as expected
Technical info
I don't know exactly what all is scrubbed from the import, but do know the Organization Name is lost, as well as the settings under Breadcrumbs > Taxonomy to show in breadcrumbs for content types
I tracked it down to values getting turned into booleans by a clean_option() method during import in:
https://github.com/Yoast/wordpress-seo/blob/16.6.1/inc/options/class-wpseo-option.php#L779
- If relevant, which editor is affected (or editors):
- [ ] Classic Editor
- [ ] Gutenberg
- [ ] Classic Editor plugin
- Which browser is affected (or browsers):
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Other
Used versions
- WordPress version: 5.7.2
- Yoast SEO version: 16.6.1 & 16.8
- Gutenberg plugin version:
- Classic Editor plugin version:
- Relevant plugins in case of a bug:
- Tested with theme:
Confirmed. The cleaning option does nothing more than returning the default options instead of the imported options. So from what I can see, nothing gets imported at all.
checking in, do you know if this has been addressed in any releases since reported? I've been watching release notes for a mention about a fix, but haven't seen anything related yet.
It has not been fixed. It currently has no priority either as far as I know. Once it's fixed it'll end up in he release notes.
Still occurs in Yoast v18.3. The organization logo isn't imported either.
The import feature is still broken for many settings in Yoast SEO 20.3. The settings below (and maybe others) are not imported correctly:
-
Website name, Tagline and Site image under
Yoast SEO > Settings > General > Site basics -
Organization name and Organization logo under
Yoast SEO > Settings > General > Site representation -
Social title and Social description under
Yoast SEO > Settings > Content Types > Homepage - Breadcrumbs settings (i.e. Separator, Anchor text for the Homepage, Breadcrumbs for post types, etc.) under
Yoast SEO > Settings > Advanced > Breadcrumbs -
RSS feed under
Yoast SEO > Settings > Advanced > RSS
Please inform the customer of conversation # 1017280 when this conversation has been closed.
Please inform the customer of conversation # 1063711 when this conversation has been closed.
Please inform the customer of conversation # 1061100 when this conversation has been closed.
Please inform the customer of conversation # 1109159 when this conversation has been closed.
Direct solution:
- In
class-wpseo-option-titles, line 882, in theforeachloop we should add cases related to the missing settings which would correctly sanitize them instead of using the default bool sanitization - In the same file, check all the settings at the beginning and
- make sure all are imported
- add documentation when needed
Improved solution (requiring investigation):
We can see that other classes managing the options just perform some upgrade-related stuff and then leave the deck to validation. For the wpseo-option-titles instead, the clean-option method seems to duplicate the validation in part, probably because it needs to handle the cases where the options are increased in number because of new post types etc. If we could get rid of this part and leave the task to the validate method, everything would be much more maintainable. Of course we need to check in a very careful way that every single option would be unaffected by this. If the scope become too complicated, let's revert to the easier solution above.