Support

Account

Home Forums General Issues Post object with conditions performance, elsif or switch or separate blocks Reply To: Post object with conditions performance, elsif or switch or separate blocks

  • I honestly don’t know if there is a way to tell if meta values have already been cached. When I’m trying to figure this out I generally install a query monitor plugin and test first with and then without the call to get_post_meta().

    Using https://wordpress.org/plugins/query-monitor/ does any of them actually say based on real queries cached or not? Using both but right now using https://wordpress.org/plugins/blackbar/

    If the queries are reduced I leave it in.

    What do you mean with leave it in? If queries is reduced it means not cache, or am I misunderstanding you or just getting late here..

    Another thing you might consider is if you’re actually going to use the post data. Will you use the post title, excerpt, content, ect, OR will you only be using custom fields from those posts. If you will not be using standard post field content then you don’t really need the post object and just the ID would be needed to get the custom fields. You can do this by either setting the field to return an array or by get_field('post_object', false, false);

    In this I only use custom fields. Could you give me a full visual example as I don’t think I understand what you mean with “or by get_field('post_object', false, false);