[buddypress-trac] [BuddyPress Trac] #7666: Load template loop functions only when the template loop is initialized

buddypress-trac noreply at wordpress.org
Tue Jan 23 02:53:30 UTC 2018


#7666: Load template loop functions only when the template loop is initialized
-------------------------+------------------------------------
 Reporter:  r-a-y        |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Core         |    Version:
 Severity:  normal       |   Keywords:  has-patch dev-feedback
-------------------------+------------------------------------
 A lot of our codebase is for template functions.

 We do not need to load this code if a template loop isn't initialized.

 For example, you can't use the `bp_activities()` or
 `bp_get_activity_item_id()` functions without initializing the activity
 template loop, right?  So it would make sense to only load this if the
 `bp_has_activities()` function was called.

 Attached patch is just an example of offshoring template functions used
 for the `bp_has_activities()` template loop; it's a 56KB file savings and
 doesn't break unit tests.

 Mutiply this technique for all our template loops across all components
 (especially for the Groups component) and we can definitely trim more fat.

 This would be noticeable on multisite installs when BP isn't on the root
 blog.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7666>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list