Related Posts not work
-
I have function:
function ep_get_related_posts($post_id = null, $related_post_count = 5) { if (class_exists('\ElasticPress\Features')) { $related_posts = \ElasticPress\Features::factory()->get_registered_feature('related_posts')->find_related($post_id, $related_post_count); if ($related_posts) { echo '<h2>Похожие новости:</h2>'; echo '<ul>'; foreach ($related_posts as $related_post) { echo '<li><a href="' . get_permalink($related_post->ID) . '">' . $related_post->post_title . '</a></li>'; } echo '</ul>'; } else { echo 'No related posts found.'; } } else { echo 'ElasticPress is not available.'; } }
When inserting into news (I have about 300k of them, news portal) I get “No related posts found”. Through the block in Gutenberg I get the same thing.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Related Posts not work’ is closed to new replies.