Opened 18 years ago
Closed 18 years ago
#3790 closed enhancement (fixed)
Change exit's to return's in template-loader.php
Reported by: | Otto42 | Owned by: | ryan |
---|---|---|---|
Milestone: | 2.2 | Priority: | lowest |
Severity: | trivial | Version: | 2.1 |
Component: | Optimization | Keywords: | has-patch |
Focuses: | Cc: |
Description
All the exit statements in template-loader.php cause the script to terminate at that point (after the blog has been rendered). This early termination makes it difficult to include Wordpress as a piece of a larger page, as script execution will end here instead of continuing to whatever is after it.
These exits are actually unnecessary, but they do reduce execution time (in theory). As such, changing these exits to returns will have the same effect. Execution of template-loader.php will end early (as desired) and it will continue back to blog-header.php (where template-loader.php was require_once'd from). From there it will return back to index.php and thus end execution. But the use of returns will allow other packages to include('index.php') to create the blog within their own page area, allowing a greater level of customization without having to hack the main Wordpress source.
So the request is to change all "exit;" statements to "return;" statements in template-loader.php.
(In [5104]) Return instead of exit in template-loader. Props Otto42 and Nazgul. fixes #3790