Influence of WordPress functions on site speed

Functions and includes (itself) don’t affect the site performance much. But…

The code inside a function can affect site speed. It all depends what exactly that function does.

For example function esc_attr won’t affect site speed, because its code is simple and will run fast.

On the other hand, functions like get_posts can take a lot of time to execute, because it has to parse your arguments, query the DB, obtain results and create objects for every row. So if you query for a lot of posts, it can consume a lot of time.

Another example of time-consuming function will be wp_remote_get. It retrieve the raw response from the HTTP request using the GET method. So you’ll have to wait for the requested server to generate answer and so on.

Also, some functions run filters/actions inside. So themes/plugins may affect speed of their execution.

Leave a Comment