Reload WordPress widgets on pjax:complete

I’m trying to use pjax on a webpage, and have encountered a problem where plugin widgets are breaking due to not being reloaded. In an attempt to solve this, I’m using a pjax:complete flag to reinitialize the widgets, for example:

(function() {   
    $(document).on('pjax:complete', function() {

However, this requires plugin-specific commands for each widget, and many of them don’t seem to actually have a javascript-accessible init function. Is there some way to do a generalized reload of wordpress widgets from this sort of conditional call?

Read more here: Reload WordPress widgets on pjax:complete

Leave a Reply

Your email address will not be published. Required fields are marked *