Skip to content

Commit

Permalink
Search by post ID for manual posts
Browse files Browse the repository at this point in the history
Fixes #195
  • Loading branch information
ajaydsouza committed Nov 3, 2023
1 parent d8e996a commit f23838a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion includes/admin/modules/metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,18 @@ function crp_get_posts_action() {
wp_send_json_error();
}

$args = array(
$args = array(
'postid' => $postid,
'posts_per_page' => 5,
'keyword' => $search_term,
'exclude_post_ids' => $exclude_post_ids,
'manual_related' => 0,
'include_words' => $search_term,
);
if ( is_numeric( $search_term ) ) {
$args['include_post_ids'] = array( $search_term );
}

$posts = get_crp_posts( $args );
$result = array();
foreach ( $posts as $post ) {
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ Contextual Related Posts is one of the many plugins developed by WebberZone. Che

= 3.4.2 =

* Enhancements:
* Live Search in the Manual Related Posts field now searches by post ID if you enter a number

* Bug fix:
* Bug in Include Words functionality where all post types were incorrectly included
* Compatibility issue with PolyLang. Return the default post if pll_get_post returns false
Expand Down

0 comments on commit f23838a

Please sign in to comment.