diff --git a/libraries/joomla/document/html/html.php b/libraries/joomla/document/html/html.php
index 9b03c7932f9e4..80bf3126c5cd8 100644
--- a/libraries/joomla/document/html/html.php
+++ b/libraries/joomla/document/html/html.php
@@ -665,6 +665,7 @@ protected function _parseTemplate()
}
// Reverse the last array so the jdocs are in forward order.
$template_tags_last = array_reverse($template_tags_last);
+ $template_tags_first = array_reverse($template_tags_first);
$this->_template_tags = $template_tags_first + $template_tags_last;
}