Skip to content

Commit

Permalink
bugfix: Do not render twice
Browse files Browse the repository at this point in the history
The wp_twig_render-Function helps rendering templates.
For some old ob_* caching reasons it did this twice
which almost doubles the runtime
and would also call functions twice
possily changing the system state / database one time too often.
We reuse the already generated content from now on.
  • Loading branch information
rmp-up committed Jun 21, 2021
1 parent 623d693 commit f199543
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@ function wp_twig_render( Twig\TemplateWrapper $template, array $context = [] ):
}

// Cast to string as ob_get_clean could return false
return (string) $template->render(
array_merge(
$context,
wp_twig_context( $template->getSourceContext()->getName(), $template->getBlockNames() )
)
);
return (string) $content;
}
}

Expand Down

0 comments on commit f199543

Please sign in to comment.