• Resolved Evan Mattson

    (@aaemnnosttv)


    Greetings! This message is for the plugin authors and maintainers.

    I am a lead developer working on Google Site Kit.

    As of our latest release (1.7), we started receiving reports of users’ sites appearing broken on the front end when logged in. After some investigation, I found that this was due to full-template output buffering being ended prematurely in the document’s <head>.

    This is due to the \WPEL_Front::action_rest_api_init method calling ob_end_clean.

    We recently added REST request preloading into Site Kit and so this causes the rest_api_init action to be fired in a normal request cycle. WordPress core does this as well in the context of the editor so it’s not safe to assume that this action is only invoked in the context of serving a REST request.

    I found that simply removing this method fixed the problem, but I am not sure if that is the correct solution for this plugin. I am happy to help if needed. The repo doesn’t seem to be public or I would have already submitted a PR ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author WebFactory

    (@webfactory)

    Hi Evan,
    Thanks for the heads up!

    We’re looking into this.

    I was going to post the same thing! I had to deactivate WP External Links because all of my websites totally broke when I updated the Google Site Kit plugin into the new version.

    Plugin Author WebFactory

    (@webfactory)

    We can remove ob_end_clean obviously not a problem ?? but the impact of that “minor” change is not that clear ?? I’m quite sure we’ll break some sites that previously worked. So we’ll most probably need to add an option, which I’m not a fan of but seems unavoidable.

    Thread Starter Evan Mattson

    (@aaemnnosttv)

    @webfactory if the intention is to not perform output buffering and link rewriting of REST responses, I think you could hook ob_start later in the request (currently is being hooked on init) where you could know if it was a REST request or not. For this plugin, I would think template_redirect would be a better hook for starting output buffering since this would never be called for REST API requests as it serves responses on the parse_request action.

    @aaemnnosttv I’m trying to fix the issue with the Google Site Kit plugin. I’m trying to replicate the issue on my side, but without success. Can You please provide the steps on how can I reproduce the issue?

    Plugin Author WebFactory

    (@webfactory)

    Fixed in v2.45

    Thread Starter Evan Mattson

    (@aaemnnosttv)

    Thanks for reaching out on Slack @manuelrocha88, awesome to see this fixed now in the latest version!

    Cheers! ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Breaking Template Output with Google Site Kit 1.7’ is closed to new replies.