您可以搜索<table>
字符串并将其替换为包装器元素:
function pb_table_render_block($block_content, $block) {
if ($block[\'blockName\'] == \'core/table\') {
$block_content = str_replace(\'<table\', \'<div class="table-wrapper"><table\', $block_content);
$block_content = str_replace(\'</table>\', \'</table></div>\', $block_content);
}
return $block_content;
}
add_filter(\'render_block\', \'pb_table_render_block\', 10, 2);