GuidePlugin LogoGuidePlugin Docs

guideplugin/result/posts

Filter the Post IDs of guide results

guideplugin/result/posts

Definition

With this filter you can filter the Post IDs of the results.

This filter allows you to modify the result set by adding or removing specific posts based on the guide ID.

Parameters

apply_filters('guideplugin/result/posts', $posts, $guide_id);
ParameterTypeDescription
$postsarrayThe Post IDs of the results
$guide_idintThe ID of the guide

Example

The example shows you how to access the Post IDs:

<?php 
function my_guide_result_posts($posts, $guide_id) { 

    // The guide result you want to modify 
    if ($guide_id == 24) {
        array_push($posts, 333); // add post_id '333' to result set
    } 
    return $posts; 
}
add_filter('guideplugin/result/posts', 'my_guide_result_posts', 10, 2);

Usage Scenarios

Add Featured Posts

Include specific posts regardless of filter criteria

Custom Filtering

Remove posts based on custom business logic

Result Modification

Fine-tune results for specific guides