Roots Discourse

Using \App\template in admin hooks results in incorrect admin page markup

When using App\template() method in an admin related hook, e.g. admin_footer, the markup changes significantly with some parts missing, which results in the Gutenberg editor not loading (blank page). No PHP notices, warnings or errors.

function gutenberg_watcher_markup() {
    <div id="page-template-watcher">
        <div id="my-root"></div>
        <div id="templates"><?php echo \App\template('editor/templates'); ?></div>
add_action( 'admin_footer', __NAMESPACE__ . '\\gutenberg_watcher_markup' );

Even when just assigning the method return to a variable and not outputting it, results in disruption of admin page markup. \App\template() somehow prevents some other hooks from working correctly.

So \App\template actually does something with wp_head action and enqueued scripts in older versions of sage. This was changed and in newer sage this doesn’t happen anymore.