Make WordPress Core

Changes between Version 1 and Version 2 of Ticket #58333, comment 73


Ignore:
Timestamp:
05/18/2023 07:41:56 PM (12 months ago)
Author:
asafm7
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58333, comment 73

    v1 v2  
    1 @domainsupport
    2 
    3 This demonstrates my thinking:
    4 
    5 
    6 {{{
    7 add_filter('get_block_templates', 'do_shortcodes_in_block_templates', 10, 3);
    8 
    9 function do_shortcodes_in_block_templates($query_result) {
    10 
    11     foreach ($query_result as &$block_template) {
    12         $block_template->content = shortcode_unautop($block_template->content);
    13         $block_template->content = do_shortcode($block_template->content);
    14     }
    15 
    16     return $query_result;
    17 }
    18 
    19 add_filter('get_block_template', 'do_shortcodes_in_block_template', 10, 3);
    20 
    21 function do_shortcodes_in_block_template($block_template) {
    22     $block_template->content = shortcode_unautop($block_template->content);
    23     $block_template->content = do_shortcode($block_template->content);
    24 
    25     return $block_template;
    26 }
    27 }}}
    28 
    29 
    30 It is a (working) draft, so try at your own risk :)