Crocoblock / suggestions

The suggestions for CrocoBlock project
191 stars 78 forks source link

[JetEngine] HTML attributes missing in displayed meta data field #7483

Open slubonski opened 2 months ago

slubonski commented 2 months ago

Describe the bug HTML code inserted in meta data field, is not showing all attributes in the end - when I would like to display this value on page. It only shows 'class' and that's it :(

To Reproduce Steps to reproduce the behavior:

  1. Create Custom Post Type, e.g.: definitions
  2. Create meta field (e.g.: key_words) for this custom post type. Meta field type: Textarea.
  3. Create a new post with value in key_words meta field. As a value, put HTML code there: <span class="keyWordClass" onClick="HiThere()" myCustomAttr="Hello world">Sample text</span>
  4. Create Listing for definitions post type
  5. In this listing, add: Dynamic Field, where Source is: Meta Data, and Meta Field: key_words. Save it.
  6. Create a test site, and put their Listing Grid, with your created listing.
  7. Open test site to check the result. Inspect your result, by checking HTML code.
  8. Result is: <span class="keyWordClass">Sample text</span>, but it should be: <span class="keyWordClass" onClick="HiThere()" myCustomAttr="Hello world">Sample text</span>

Expected behavior My HTML code inserted in the meta data field (in this example in 'key_words') should be displayed correctly. Meaning, it should show all HTML attributes. That's it.

Screenshots image

Desktop (please complete the following information):

PS. Im using JetEngine 3.4.2.

Crocoblock commented 2 months ago

Hi @slubonski

To solve this issue you need to disable sanitize

add the next snippet https://prnt.sc/QreTThkb1qqq to the functions.php file of your child theme:

https://gist.github.com/Crocoblock/f8802e82a36689fdae6dcb104b28edff

Then, display the meta field with a Dynamic Field widget. Add the 'disable-sanitize' class to the Dynamic Field: https://prnt.sc/1dMvdRMeHZHU