Title: post_type php error
Last modified: January 17, 2025

---

# post_type php error

 *  Resolved [memoryfun3](https://wordpress.org/support/users/memoryfun3/)
 * (@memoryfun3)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/post_type-php-error/)
 * in \plugins\blockmeister\includes\Pattern_Builder\Admin\BlockMeister_Pattern_List_Table.
   php
 * there is post_type php error on line 948.
 * The issue occurs in the line
 *     ```wp-block-code
       $wp_query->query['post_type']
       ```
   
 * which triggers an error if the post_type key does not exist.
 * After modifying the code as follows, the error message no longer appears.
 *     ```wp-block-code
       public function filter_table_list_rows_on_category( $posts, $wp_query ) {    if ( !isset( $wp_query->query['post_type'] ) || $wp_query->query['post_type'] !== 'blockmeister_pattern'         || !isset( $_GET['filter_action'] ) || !isset( $_GET['category'] ) || $_GET['category'] === '0' ) {        return $posts;    }        $category_filter = $_GET['category'];    $filtered_posts = [];        foreach ( $posts as $post ) {        $pattern_name = $this->get_pattern_name( $post );        $registered_block_pattern = $this->get_registered_pattern( $pattern_name );        $pattern_categories = ( isset( $registered_block_pattern['categories'] ) ? $registered_block_pattern['categories'] : [] );        if ( in_array( $category_filter, $pattern_categories, true ) ) {            $filtered_posts[] = $post;        }    }        return $filtered_posts;}
       ```
   
    -  This topic was modified 1 year, 4 months ago by [memoryfun3](https://wordpress.org/support/users/memoryfun3/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [BlockMeister](https://wordpress.org/support/users/blockmeister/)
 * (@blockmeister)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/post_type-php-error/#post-18249718)
 * Thank you for taking the time for reporting and finding and sharing the fix!
   
   I will add the fix in the next minor release (planned by the end of this month).
   I will update this topic when the fix version has been released.
 *  Plugin Author [BlockMeister](https://wordpress.org/support/users/blockmeister/)
 * (@blockmeister)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/post_type-php-error/#post-18266379)
 * The new version (3.1.12) with the fix has been released.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘post_type php error’ is closed to new replies.

 * ![](https://ps.w.org/blockmeister/assets/icon-256x256.png?rev=2598699)
 * [BlockMeister - Block Pattern Builder](https://wordpress.org/plugins/blockmeister/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/blockmeister/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/blockmeister/)
 * [Active Topics](https://wordpress.org/support/plugin/blockmeister/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/blockmeister/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/blockmeister/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [BlockMeister](https://wordpress.org/support/users/blockmeister/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/post_type-php-error/#post-18266379)
 * Status: resolved