Description
Yoast plugin adds advanced editor to term description, in MLP metabox, the term description field value is sanitized using sanitize_textarea_field resulting in HTML tags removed in remote term descriptions when term is saved.
Steps to reproduce the issue
Create a post category and in the description create an H1 tag title.
Connect it to another site through MLP translation Metabox.
Once connected, edit category in the remote site, click update button.
Go back to source site edit category.
What should happen?
H1 tag in description should exist.
What happened instead?
H1 tag in description does not exist.
Proposed solution
In order to prevent the above, we can use wp_kses_post which also sanitizes but allows basic HTML tags. In order to do so, in src/multilingualpress/TranslationUi/Term/MetaboxFields.php in FIELD_DESCRIPTION metabox field, replace sanitize_textarea_field to wp_kses_post.
Description Yoast plugin adds advanced editor to term description, in MLP metabox, the term description field value is sanitized using
sanitize_textarea_field
resulting in HTML tags removed in remote term descriptions when term is saved.Steps to reproduce the issue
What should happen? H1 tag in description should exist.
What happened instead? H1 tag in description does not exist.
Proposed solution In order to prevent the above, we can use
wp_kses_post
which also sanitizes but allows basic HTML tags. In order to do so, in src/multilingualpress/TranslationUi/Term/MetaboxFields.php in FIELD_DESCRIPTION metabox field, replacesanitize_textarea_field
towp_kses_post
.