WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 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.

Attachments (1)

3790.diff (2.4 KB) - added by Nazgul 8 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 @Otto428 years ago

  • Version set to 2.1

comment:2 @ryan8 years ago

  • Owner changed from anonymous to ryan

@Nazgul8 years ago

comment:3 @Nazgul8 years ago

  • Keywords has-patch added
  • Milestone changed from 2.3 to 2.2

comment:4 @ryan8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5104]) Return instead of exit in template-loader. Props Otto42 and Nazgul. fixes #3790

Note: See TracTickets for help on using tickets.