Skip Navigation

[Resolved] Conflict with WP Astra and Toolset

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by dbarber 1 year, 3 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#2203155

After recent updates to Astra and Toolset, I found that sites using a custom loop would no longer output the loop. Instead they would only output the content from the page they were added to.

I contacted the Astra support team and they provided the following code, which "fixed" the issue:

function remove_inner_group_container_filter( $block_content, $block ) {

$group_with_inner_container_regex = '/(^\s*<div\b[^>]*wp-block-group(\s|")[^>]*>)(\s*<div\b[^>]*wp-block-group__inner-container(\s|")[^>]*>)((.|\S|\s)*)/';

if (
( isset( $block['blockName'] ) && 'core/group' !== $block['blockName'] ) ||
1 === preg_match( $group_with_inner_container_regex, $block_content )
) {
return $block_content;
}

$replace_regex = '/(^\s*<div\b[^>]*wp-block-group[^>]*>)(.*)(<\/div>\s*$)/ms';

$updated_content = preg_replace_callback(
$replace_regex,
function( $matches ) {
return $matches[1] . $matches[2] . $matches[3];
},
$block_content
);

return $updated_content;
}

add_action( 'after_setup_theme', 'remove_render_block_filter' );

function remove_render_block_filter() {
remove_all_filters( 'render_block' );
add_filter( 'render_block', 'remove_inner_group_container_filter', 99, 2 );
}

#2204585

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

Thanks for sharing the solution, it will help other users.

Did you need more assistance for it?

#2204743

Hi Luo

I was hoping that there might be an update coming to Toolset that would address the issue, rather than having to rely on a workaround.

If that's not going to be the case, please just let me know.

#2205693

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

As I understand from the custom codes you mentioned above, Astra plugin/them was using filter hook render_block to change outputs of all WordPress blocks, and above codes can remove their custom filters when this block is a non WordPress built-in(core/group) block.

I don't think we can apply their custom codes in Toolset plugins, you might ask Astra support to apply their fix in Astra plugin/theme

#2209329

Thanks, Luo. I'll follow up with the Astra support team.