Title: Feature: Limit Post Types
Last modified: November 8, 2019

---

# Feature: Limit Post Types

 *  [syhc](https://wordpress.org/support/users/syhc/)
 * (@syhc)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/feature-limit-post-types/)
 * Right now, I have modified the PPP plugin to limit the post types that the PPP
   will work with by adding a filter. It would be nice if the plugin support such
   a filter so I do not have to modify the plugin.
 * For those who are wondering how I did it:
 *     ```
       public static function post_submitbox_misc_actions() {
           $post_types = get_post_types(
               array(
                   'public' => true,
               )
           );
           $post_types = apply_filters('ppp_post_types', $post_types);
           ...
       ```
   
 *     ```
       public static function enqueue_script( $hook_suffix ) {
           if ( ! in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true ) ) {
               return;
           }
   
           if ( ! in_array(get_current_screen()->post_type, apply_filters('ppp_post_types', []))  ) {
               return;
           } elseif ( get_current_screen()->is_block_editor() ) {
               ...
       ```
   
 * For the enqueue_script version, it might been better to pass the post types into
   Gutenberg block.

The topic ‘Feature: Limit Post Types’ is closed to new replies.

 * ![](https://ps.w.org/public-post-preview/assets/icon-256x256.jpg?rev=3190626)
 * [Public Post Preview](https://wordpress.org/plugins/public-post-preview/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/public-post-preview/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/public-post-preview/)
 * [Active Topics](https://wordpress.org/support/plugin/public-post-preview/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/public-post-preview/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/public-post-preview/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [syhc](https://wordpress.org/support/users/syhc/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/feature-limit-post-types/)
 * Status: not resolved