Skip to content

BUG: _prime_post_caches #4206

@maciejmackowiak

Description

@maciejmackowiak

Describe the bug

When the get_es_posts runs shouldn't there also be a call to _prime_post_caches?

While testing backend search in wp admin posts list using EP plugins adds ton of additional queries for posts, posts meta, terms meta etc. while the default wp query is using the prime post caches function and do it in a bulk.

For now we added this as a workaround:

add_action('ep_wp_query', function ($new_posts) {
    $post_ids = [];
    foreach ($new_posts as $key => $post) {
        $post_ids[]= (int) $post->ID;
    }
    _prime_post_caches($post_ids);
});

Steps to Reproduce

Described above.

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress and ElasticPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions