Title: tshingleton's Replies | WordPress.org

---

# tshingleton

  [  ](https://wordpress.org/support/users/tshingleton/)

 *   [Profile](https://wordpress.org/support/users/tshingleton/)
 *   [Topics Started](https://wordpress.org/support/users/tshingleton/topics/)
 *   [Replies Created](https://wordpress.org/support/users/tshingleton/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/tshingleton/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/tshingleton/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/tshingleton/engagements/)
 *   [Favorites](https://wordpress.org/support/users/tshingleton/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Loading a default pattern per custom post type](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/)
 *  Thread Starter [tshingleton](https://wordpress.org/support/users/tshingleton/)
 * (@tshingleton)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/#post-17549539)
 * [@leifer](https://wordpress.org/support/users/leifer/) 
   This is exactly what 
   I was looking for! Implemented and works great!Thanks for taking the time to 
   figure this one out and share
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Loading a default pattern per custom post type](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/)
 *  Thread Starter [tshingleton](https://wordpress.org/support/users/tshingleton/)
 * (@tshingleton)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/#post-17546433)
 * [@leifer](https://wordpress.org/support/users/leifer/) Thanks for sharing the
   workaround! I may have to go this route, if I can’t find a solution here.
 * Ideally, would be great to allow editors to edit patterns on the backend and 
   having that update as appropriate, vs using the importer.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Loading a default pattern per custom post type](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/)
 *  Thread Starter [tshingleton](https://wordpress.org/support/users/tshingleton/)
 * (@tshingleton)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/loading-a-default-pattern-per-custom-post-type/#post-17537961)
 * Thanks [@mdshak](https://wordpress.org/support/users/mdshak/)! This got me very
   close. A few things:
   – I had to reference ‘$post->post->post_type’ instead of‘
   $post->post_type’ in the conditional, as the latter threw an undefined error —
   this appears to be working now– I’m getting the WSOD (wp_debug on, no errors 
   printed on screen) if I’m using the full code snippet. I commented out the line
   of code that I determined is the culprit. Running as is of course means the code
   does nothing; I need to uncomment and solve for that line if no one can beat 
   me to it!– Confirmed that ‘2601’ corresponds to the ID of a pattern on my siteThank
   you again for the help! Anyone interested in taking a shot at solving this would
   be appreciated!Here’s the code right now:
 *     ```wp-block-code
       /*
       * Load custom patterns per post type
       */
   
       function load_post_type_patterns( $editor_settings, $post ) {
   
           if ( 'book' === $post->post->post_type ) { // Define an initial pattern for the 'Book' post type
               $editor_settings['__experimentalFeatures']['unfilteredTemplates']['book_template'] = array(
                   array(
                       'title' => 'Book Template',
                       'content' => array(
                           array(
                               'core/block',
                               array(
                                   'ref' => 2601, // The ID of your custom pattern
                               ),
                           ),
                       ),
                   ),
               );
               //$editor_settings['template'] = 'book_template';
           }
   
           return $editor_settings;
       }
   
       add_filter( 'block_editor_settings_all', 'load_post_type_patterns', 10, 2 );
       ```
   
    -  This reply was modified 2 years, 2 months ago by [tshingleton](https://wordpress.org/support/users/tshingleton/).

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