Pilot-in / PiloPress

The most advanced WordPress Page Builder using Advanced Custom Fields & TailwindCSS
https://www.pilopress.com
62 stars 11 forks source link

Fix Pilo'Press patterns when using Polylang #238

Closed DamChtlv closed 1 year ago

DamChtlv commented 1 year ago

There was multiple issues regarding Patterns and Polylang compatibility:

  1. Having Polylang Pro didn't trigger Pilo'Press Polylang compatibility because of is_plugin_active('polylang/polylang.php') use.

  2. There was also an issue causing patterns to generate more posts than it should have (ex: 1 CPT with 3 languages was generating 8 posts instead of 4 because of the original post not being set default language before generating translations) This issue was only occuring when the post-type was made / active before Polylang was active.

Test case to reproduce the issue:

  1. First, deactivate Polylang if it's active
  2. Register a new post-type
  3. Go to Patterns > Locked content and see if your post-type is correctly there
  4. Activate Polylang plugin
  5. Set some languages (ex: French as default language and English as additional language)
  6. Go back to Patterns > Locked content and search for your registered post-type
  7. When the issue occur, you should have 2 "Post-type: ..." posts of the default language and 2 of the English language instead of just 1 of each.
  8. Switch to this pull request / branch and do the test case again to see if it fixed the issue.