Fixing JS Templates in the Inner Content of [um_loggedin] Shortcode
This document explains how to fix issues when using JavaScript templates in the inner content of the [um_loggedin]
shortcode, particularly when customers use nested shortcodes like the UM Member Directory. Due to security rules, Ultimate Member uses wp_kses
to sanitize output, which can strip dynamic content. Here’s a solution that avoids wp_kses
while ensuring dynamic content is correctly displayed.
Solution: Modify functions.php
To bypass wp_kses sanitization and allow dynamic content such as JavaScript templates within the [um_loggedin]
shortcode, you can add the following function to your theme's functions.php file.
Why wp_kses Cannot Be Removed
Ultimate Member applies wp_kses
for security reasons to prevent potentially harmful code from being executed within user-generated content. While this prevents the use of certain dynamic content like JavaScript templates, it protects against malicious code injections. The function provided above allows you to bypass this restriction in specific cases while still maintaining control over content output.
Conclusion
By adding the custom function to functions.php, you can use JavaScript templates or other dynamic content inside the [um_loggedin]
shortcode without being restricted by wp_kses
sanitization.
Related Articles:
Restrict content on a page/post to logged in users