Best Practice to display posts which contain a certain metadata

I’m working on a theme that allows the user to add meta data to a post.

I want to display all the posts with my custom meta data on a front end page.

However I am unsure the best way to go about this. I know I can loop through all the posts in the database, and scan each post for my metadata. If the metadata is found then display the post.

However if the user has hundreds or thousands (or maybe tens of thousands) of posts I can’t imagine this being very efficient.

I’m new to database development in general so maybe this is just what has to happen, but is there any way to group these posts together and make a single query call to this “group”? Or something similar.

Read more here:: Best Practice to display posts which contain a certain metadata

Leave a Reply

Your email address will not be published. Required fields are marked *