0

I started building a custom theme and I might need to have around 10 to 20 custom fields for posts and I need to 30 custom fields for theme options and image ads banner, and thinking if this will affect the speed of the site.

I will also use these custom fields for WP_Query as meta_key.

I have used ACF plugin before, but because I have a lot of advertising banners inside the site page, the loading of the banner images was slower than other default WordPress queries.

Do you think using ACF is better or option tree?

1
  • if you're looking for recommendations you should ask at the software reccommendations stack and shopping questions are offtopic here. However I've left an answer as no plugin recommendation will provide the performance fix you're looking for.
    – Tom J Nowell
    Mar 4, 2023 at 18:06

1 Answer 1

1

Neither will be faster because the root of the performance problem is the WP table design, not the plugin. The post meta table is optimised for finding values when you already know the post ID/keys, it's not designed for searches, though there are mitigations.

Searches/grouping/finding is what the taxonomy tables were created for. Finding all posts that have X category or Y post tag is fast because that's what those tables are designed for, it's why tags/etc aren't stored in post meta.

Shopping around for plugins won't have any impact on this because they're still post meta values, no matter what system or framework you used to create them.

What To Do

If you need to search for posts via a meta value, that means either the field should have been a custom taxonomy, or it needs to be recreated in a taxonomy in such a way that it's easier to search for ( e.g. storing precise values in post meta for display, and bucketed/approximate values in a term ).

So I Should Only use Taxonomy Terms and Never Use Post Meta?

No!!! Using one thing for everything is what got us into this mess in the first place!

Post meta is great for stuff you need to display and store, but it's not good for searching/filtering. WP will even bulk fetch all the meta that belongs to a post to save time and optimise things. It's figuring out which posts that's expensive.

2
  • Thank you. Can you tell us which solution is better to use for each of these cases? 1- Template settings and images of advertising banners and displaying them on all pages of the site. 2- Creating an option to choose the display position of each post in a separate section of the home page using WP_Query 3- Displaying many fields on the page of each post
    – och
    Mar 4, 2023 at 18:25
  • those all sound like interesting questions, you should ask separate questions for each, I can only write an answer for your original question though as this isn't a message-board it's a Q&A site, I can't just go through all 30 fields saying yes and no. The rule of thumb is, if you need to filter/search by the value, it goes in a custom taxonomy. E.g. if you have an archive for all posts where the field is X, or can filter to only show posts with Y then that field should be a taxonomy. You usually know this because you have to use meta_query or meta_key to find the posts
    – Tom J Nowell
    Mar 4, 2023 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.