Title: Custom Post Layout Hook does not work
Last modified: March 22, 2026

---

# Custom Post Layout Hook does not work

 *  Resolved [slawekmuniak](https://wordpress.org/support/users/slawekmuniak/)
 * (@slawekmuniak)
 * [2 months, 3 weeks ago](https://wordpress.org/support/topic/custom-post-layout-hook-does-not-work/)
 * Hi, I want to customize Post Layout by using this hook: 
   [https://github.com/YMC-22/YMC-Filter/blob/main/README.md#custom-post-layout](https://github.com/YMC-22/YMC-Filter/blob/main/README.md#custom-post-layout)
   Why? I want to use some shortcode, but I need to pass there the actual post_id(
   _like: [shortcode id=”{postID}”]_). I did not find any simple solution for that
   in your builder, so I want to override post Layout and make it possible from 
   the code. I added code in my theme** functions.php**:
 *     ```wp-block-code
       add_filter('ymc/post/layout/custom_880', function($output, $post_id, $filter_id, $popup_class, $term_settings) {    $output = 'TEST';    return $output;}, 10, 5);
       ```
   
 * I assume that all items in my filter will show just text: **TEST**, but I still
   see my layout from Structural builder. I searched your plugin code, and I do 
   not see any calls for **apply_filters(ymc/post/layout/custom**…. Is this functionality
   ready to use or I should do more to make it work?

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

 *  Plugin Author [YMC](https://wordpress.org/support/users/wssoffice21/)
 * (@wssoffice21)
 * [2 months, 3 weeks ago](https://wordpress.org/support/topic/custom-post-layout-hook-does-not-work/#post-18859075)
 * Hi!
 * We’d be happy to help you solve your task. You can override the default post 
   card layout with a custom post card layout. To do this, follow these steps:
    1. In the plugin settings, under Layouts – Post Layout, select Custom Post Layout
       from the Post Layout drop-down list (see screenshot [https://prnt.sc/P4aqCDviVXws](https://prnt.sc/P4aqCDviVXws)).
    2. Then, in your theme’s functions.php file, write the following code and use the
       filter (hook) 
       **‘ymc/post/layout/custom_880’**, like in your example:`add_filter('
       ymc/post/layout/custom_880', function($output, $post_id, $filter_id, $popup_class,
       $term_settings) {$output = 'TEST';return $output;}, 10, 5);Be sure to check 
       your filter ID (e.g. 880)You can improve your code:add_filter('ymc/post/layout/
       custom_880', function($output, $post_id, $filter_id) {ob_start(); ?><h2>TEST
       </h2> <p>Post content</p><?php return ob_get_clean();}, 10, 3);By the way, you
       can also use **Structural Builder,** this is a powerful tool for creating a 
       post card!This solution is more convenient if you need to output a lot of HTML
       code. We hope this helps.
 *  -  This reply was modified 2 months, 3 weeks ago by [YMC](https://wordpress.org/support/users/wssoffice21/).
 *  Thread Starter [slawekmuniak](https://wordpress.org/support/users/slawekmuniak/)
 * (@slawekmuniak)
 * [2 months, 3 weeks ago](https://wordpress.org/support/topic/custom-post-layout-hook-does-not-work/#post-18859092)
 * Hi, 
   Thanks for your response, I was able to resolve my problem. The main issue
   on my side was selecting **Structural Builder** and trying to apply the hook.
   The PHP hooks does not work with Structural Builder. I had to use Classic Layout
   for Custom Post Layout type.
 *  Plugin Author [YMC](https://wordpress.org/support/users/wssoffice21/)
 * (@wssoffice21)
 * [2 months, 3 weeks ago](https://wordpress.org/support/topic/custom-post-layout-hook-does-not-work/#post-18859096)
 * Good Luck!

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcustom-post-layout-hook-does-not-work%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/ymc-smart-filter/assets/icon-128x128.png?rev=3354891)
 * [YMC Filter](https://wordpress.org/plugins/ymc-smart-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ymc-smart-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ymc-smart-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/ymc-smart-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ymc-smart-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ymc-smart-filter/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [YMC](https://wordpress.org/support/users/wssoffice21/)
 * Last activity: [2 months, 3 weeks ago](https://wordpress.org/support/topic/custom-post-layout-hook-does-not-work/#post-18859096)
 * Status: resolved