PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 2, 2022

[FIXED] It automatically deletes the <script> tag in the description section of the category

 February 02, 2022     php, wordpress     No comments   

Issue

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


Solution

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.



Answered By - Mark Truitt
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing