Helick Related Posts WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Simple related post plugin with ElasticPress integration
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/helick/related-posts/archive/refs/heads/master.zipOn Packagist as helick/related-posts:
composer require helick/related-postsThe plugin provides a simple related posts functionality with the following features:
- Ability to manually override related posts
- ElasticPress integration
Requirements
Make sure all dependencies have been installed before moving on:
Install
Via Composer:
$ composer require helick/related-posts
Usage
The plugin exposes a single function that returns a list of post IDs.
$postIds = Helick\RelatedPosts\get(int $postId, array $args = []);
$postId is the ID of the post to get related content for.
$args allows you some control over the posts that are returned:
- int limit: defaults to
10 - array post_types: array of post types to limit results to, defaults to
['post'] - array taxonomies: array of taxonomies to compare against, defaults to
['category'] - array terms: array of
WP_Termobjects, results will match these terms - array terms_not_in: array of
WP_Termobjects, results will not match these terms - bool ep_integrate: if true then ElasticPress is used to get the results, defaults to
defined('EP_VERSION')
Custom post type support
Control supported post types:
add_filter('helick_related_posts_supported_post_types', function (array $postTypes) {
$postTypes[] = 'your-custom-post-type';
return $postTypes;
});
Control associated post types:
add_filter('helick_related_posts_associated_post_types', function (array $postTypes) {
$postTypes[] = 'your-custom-post-type';
return $postTypes;
});
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email evgenii@helick.io instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Releases
4 releases.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.