Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

After having a hard time figuring out what plugin in my WordPress site causes a low page load speed, this happens to be the most important plugin ACF (advanced custom fields Pro).

But I think I know the reason, I created a theme on my own that feet my needs, however in this theme the post loop load few ACF fields (and I just have to do that unfortunately ), the fields are loaded with the basic call function get_field(), but probably because this fields are inside the loop this causes a long load time ( extremely high, this actually add a entire 4 seconds the load time!!).

I am a developer but I am not professional one but as much as I understand this happens because each time the function get_field() calls a query and that makes the long page load time, so I figured out that maybe there is a way to cache all the fields that I need before the loop so it won't take so much time to load? Or maybe there is much better solution that I can't think about? Seriously any ideas are welcome, because I am stuck and hoping there someone here with a fresh idea.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
201 views
Welcome To Ask or Share your Answers For Others

1 Answer

I'm not familiar with the ACF plugin, but it seems that you are very sure that this is causing the issue. By default, custom fields should not impact performance, whether you have one or one thousand. See this post I have done on the issue of custom fields

I would sugget that download and install a plugin like Query Monitor which prints all the relevant info to screen about the amount of db calls and the time taken for each db call. Just a note, don't run this on a production site. Do this on a local test install or put your site on maintance mode. You don't want your users being dished up with pages of query info that will not make sense to them :-). As I said, the plugin prints the information straight to the screen


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...