GuidePlugin LogoGuidePlugin Docs

guideplugin/guide/post_types

Adjust the included and excluded post types for guides

guideplugin/guide/post_types

Definition

With this filter you can adjust the included and excluded post types.

This filter allows you to control which post types are included or excluded in a specific guide.

Parameters

apply_filters('guideplugin/guide/post_types', $post_type_settings, $guide_id);
ParameterTypeDescription
$post_type_settingsarrayThis array contains the information to include or exclude post types
$guide_idintThe ID of the guide

Post Type Settings Structure

The $post_type_settings array looks like this:

$post_type_settings = array(
    'option' => 'include', // Include or exclude post types?
    'selection' => ['post', 'page', 'books'], // post type slugs
);

Example

The example shows you how to customize the included post types:

<?php
function my_guide_post_types($post_type_settings, $guide_id) {
    if ($guide_id == 24) { // The guide you want to modify
        array_push($post_type_settings['selection'], 'books'); // Add slug 'books' to post type selection
    }
    return $post_type_settings;
}
add_filter('guideplugin/guide/post_types', 'my_guide_post_types', 10, 2);

Usage Scenarios

Custom Post Types

Include custom post types like products or events

Dynamic Selection

Change post types based on guide ID or conditions

Content Control

Fine-tune which content appears in guides