• Resolved strangefortune

    (@strangefortune)


    Hello, and thank you for the great plugin! Ever since WP was updated to 5.9, I am noticing javascript that I insert into the staff bio is stripped out when I update the staff post.

    I have been using scripts in the bio for years now with no previous issues. Here is the script that is being stripped out when a bio is updated or created. Current staff posts are unaffected.
    <script src=”https://widgets.mindbodyonline.com/javascripts/healcode.js&#8221; type=”text/javascript”></script>
    <healcode-widget data-type=”schedules” data-widget-partner=”object” data-widget-id=”441704724b6f” data-widget-version=”1″ ></healcode-widget>

    Is it possible to update the plugin so it’s compatible with the new version of WP?

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brett Shumaker

    (@brettshumaker)

    Hi @strangefortune

    The reason that is being stripped out is related to the latest version of the plugin where I (intentionally) changed how the fields were displayed for security reasons. This isn’t related to updating WordPress to 5.9.

    There is a filter available that allows you to change what’s allowed in the bio field. If you add the following snippet to your theme’s functions.php file (or add it to a custom plugin) you’ll be able to use those scripts again:

    
    
    add_filter( 'sslp_staff_member_bio_kses_allowed_html', function( $allowed_html ) {
        // Still allow all elements from the &quot;post&quot; context.
        $allowed_html = wp_kses_allowed_html( 'post' );
    
        // Allow script tags.
        $allowed_html['script'] = [
            'src' => [],
            'type' => []
        ];
    
        // Allow this custom DOM element.
        $allowed_html['healcode-widget'] = [
            'data-type' => [],
            'data-widget-partner' => [],
            'data-widget-id' => [],
            'data-widget-version' => []
        ];
        return $allowed_html;
    }, 10 );

    Thread Starter strangefortune

    (@strangefortune)

    Thank you so much Brett for the quick reply and solution – worked like a charm!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Scripts in Bio Stripped since Upgrade to WP 5.9’ is closed to new replies.