Home > Blockchain >  It automatically deletes the <script> tag in the description section of the category
It automatically deletes the <script> tag in the description section of the category

Time:02-02

I tried to use the category description to add schema to the categories, but it automatically deletes the tag after saving it.

is there a way to prevent this in wordpress

enter image description here

after recording;

enter image description here

CodePudding user response:

For security fields like this tend to be sanitized to prevent random scripts from being injected.

You are better off using wp_enqueue_script or wp_head

https://developer.wordpress.org/reference/functions/wp_enqueue_script/

https://developer.wordpress.org/reference/functions/wp_head/

Using wp_enqueue_script you could check against the category and have it add it that way which also makes it so it only shows up within that/those categories.

  •  Tags:  
  • Related