Description:
The visibility conditions set for a template are removed when switching language using the language dropdown from the top bar. So far we observed this issue only on the Themer page.
When viewing the Themer page (initial page load) or updating the visibility conditions for any template, the visibility conditions for all the templates are sent from the frontend to this endpoint: /wp-json/cwicly/v1/options?_locale=user. When the language is switched, only the templates that are translated are listed. So if I haven’t translated a template, it’s not listed and the request to the backend does not have the previously set conditions for the original template. So every time I switch languages for other pages, come back to the Themer page, since the templates are not translated yet, I lose all visibility conditions for the templates.
Step-by-step reproduction instructions:
- Go to WP Admin.
- Install and activate the plugins ACF, Cwicly, WPML, WPML String Translation
- When setting up WPML, make sure you select the ‘Translate What You Choose’ option for Translation Mode.
- Install and activate Cwicly theme
- Create a new post type
- Create a test post with the new post type
- Create a template using Cwicly for this new post type and set the visibility conditions.
- Go to the Themer page and switch language using the language dropdown from the top admin bar. Note: The newly created template will not be listed here as it is not yet translated.
- Switch back to the original language.
- The visibility condition for the template will be removed now.
Environment info
WordPress version: 6.2.2
Cwicly Plugin version: 1.3.2.1
WPML version: 4.6.5
WPML String Translation version: 3.2.7
PHP version: 8.1