• I created some custom HTML tags, but when they pass through the wp_kses_post() function, they get stripped.
    I tried to add the them into the global variable $allowedposttags, but they get removed.
    Any idea on how to permanently set custom tags for the wp_kses_post() function?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The problem with altering a global is something else can change it back. Instead, you should use the “wp_kses_allowed_html” filter. If you add your callback with a priority of PHP_INT_MAX, your callback should have the final say.

    Custom HTML tags? Wouldn’t that result in invalid HTML? How would browsers know how to deal with such tags? A little off topic. You’ve no obligation to answer, but I’m curious.

    Thread Starter antonop4u

    (@antonop4u)

    bcworkz Thanks.
    Regarding the custom tags, I’ve notice (I actually read it some where but i honestly don’t remember where) that if you set <custtag>something</custtag> the browser I used so far (crome, edge,opera,firefox…) have no problem recognizing them as html tags. Even in Javascript element.tagName = 'CUSTTAG'.
    I’m not sure if it’s SEO problem. I normally use them in the the back end not visible to the search engines.

    Moderator bcworkz

    (@bcworkz)

    Yes, it’s not a problem per se, but I don’t see what purpose it serves. It’ll cause a validation error somewhere like validator.w3.org, but no other ill effect AFAIK. Thanks for the explanation.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘wp_kses_post custom html tags’ is closed to new replies.