wordpress-seo icon indicating copy to clipboard operation
wordpress-seo copied to clipboard

Import Settings broken, many values ignored

Open andyblackwell opened this issue 4 years ago • 10 comments

  • [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?

  1. have some settings set, like: Search Appearance > General > Organization Name
  2. export settings
  3. import into a different setup, or change orginal setting values before re-importing to same install
  4. 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:

andyblackwell avatar Aug 09 '21 18:08 andyblackwell

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.

Djennez avatar Aug 10 '21 06:08 Djennez

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.

andyblackwell avatar Oct 07 '21 16:10 andyblackwell

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.

Djennez avatar Oct 08 '21 08:10 Djennez

Still occurs in Yoast v18.3. The organization logo isn't imported either.

monbauza avatar Mar 17 '22 07:03 monbauza

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

monbauza avatar Mar 20 '23 08:03 monbauza

Please inform the customer of conversation # 1017280 when this conversation has been closed.

josevarghese avatar May 14 '23 08:05 josevarghese

Please inform the customer of conversation # 1063711 when this conversation has been closed.

amboutwe avatar Oct 07 '23 17:10 amboutwe

Please inform the customer of conversation # 1061100 when this conversation has been closed.

amboutwe avatar Oct 07 '23 18:10 amboutwe

Please inform the customer of conversation # 1109159 when this conversation has been closed.

shabnam611 avatar Mar 01 '24 06:03 shabnam611

Direct solution:

  • In class-wpseo-option-titles, line 882, in the foreach loop 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.

pls78 avatar Apr 30 '24 09:04 pls78