Closed JiveDig closed 2 years ago
Confirmed we are just returning Id's with Custom results. The problem might lie here https://github.com/10up/ElasticPress/blob/develop/includes/classes/Feature/SearchOrdering/SearchOrdering.php#L658
@oscarssanchez @JiveDig can you please check if #3010 fixed this problem? Thanks!
Sorry for the delay. Yep! #3010 fixes it for me. I'm running master branch and manually changed the 2 lines in SearchOrdering.php and it works as expected. Thanks!
Works for me as well!
Describe the bug
We're trying to speed up queries by using
update_post_thumbnail_cache()
on the search results query. When using custom search results it seems the reordered posts are added to the query as anID
instead of the entireWP_Post
object.WP core throws an error in
/wp-includes/post-thumbnail-template.php
on line 116$id = get_post_thumbnail_id( $post->ID );
. The error is:Trying to get property 'ID' of non-object
. When I dump$post
inside that loop, the custom ordered search results dump aninteger
(the post ID) instead of the post object.Steps to Reproduce
Add the following code to your site.
}, 10, 2 );