Closed JiveDig closed 9 months ago
Testing removing link attribute from the block data before it's parsed.
add_filter( 'render_block_data', 'mai_render_block_data_handle_link_color', 10, 3 );
/**
* Removes inline styles from blocks.
*
* @since TBD
*
* @param array $parsed_block The block being rendered.
* @param array $source_block An un-modified copy of $parsed_block, as it appeared in the source content.
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
*
* @return array
*/
function mai_render_block_data_handle_link_color( $parsed_block, $source_block, $parent_block ) {
// Remove link colors from inline styles.
if ( isset( $parsed_block['attrs']['style']['elements']['link']['color'] ) ) {
unset( $parsed_block['attrs']['style']['elements']['link']['color'] );
}
return $parsed_block;
}
This is a Media/Text block with text color set, and it's affecting
<a>
link colors.