Site logo

Archived topic

Hook elements vs. functions.php - performance

7 replies · Started by mkjj on June 18, 2021

Viewing posts 1–8 of 8

Usually, I put all hooks in the functions.php of the child theme. However, the hook elements (or elements hooks?) are sometimes very handy. How would you compare both methods in terms of performance? I doubt that there is a significant difference. Thank you!

Hi there,

How would you compare both methods in terms of performance?

You can add the same hook using function.php and an element and run some speed tests on your site.

I doubt that there is a significant difference.

I think so too!

Ok, will do and post the results. Have just to think about something more complicated that needs some more server ressources to perform.

Sounds good :)

Looks like you forgot to post the results? ;)

Looks like you forgot to post the results? 😉

Not really. I forgot to perform the tests. :-)

Using Elements are very handy.
It would be great if you GP could tell us about performance difference using Elements and functions.php

Hi there,

Elements are a Custom Post, and therefore 1 query is required to load them.
So if you're using a Child Theme and you moved a basic function to an Element you would see 1 additional query.

Will you notice that additional query - i doubt it. Its not a complex slow query. And the elements result can be cached in most cases.

This archived topic is closed to new replies.