guideplugin/guide/post_types

Definition

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

Parameters

appy_filters('guideplugin/guide/post_types', $post_type_settings, $guide_id);
  • $post_type_settings  (array) This array contains the information to include or exclude post types.
  • $guide_id (int) The ID of the guide.

 

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);