[wp-hackers] PHP Include Question - Best Practice

michael at mfields.org michael at mfields.org
Sun Feb 14 04:03:14 UTC 2010


Hi. I'm putting together a small collection of functions that extend
WordPress' image handling functionality. One of the functions returns a
custom intermediate image size if one is found and has a parameter which
(if set to true) will attempt to create the image using image_resize() - a
core function.

In the event that the function needs to create a new intermediate size,
'/wp-admin/includes/image.php' needs to be included which leads me to this
question:

"Is there any performance penalty for using include_once() in a function
that will most likely be called many times during the duration of a
script?"

It makes sense to me to only include the file if the function is set to
create a new intermediate image, but if this could effect performance, I
would rather just include it once outside of the function which uses it.

Thanks!
Mike



More information about the wp-hackers mailing list