Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Filters the output of the Tasty Recipes block.
*
* @param string $output Existing output.
* @param array $block Block data.
* @return string
*/
add_filter( 'render_block', function( $output, $block ){
// Only modify the Tasty Recipes block.
if ( 'wp-tasty/tasty-recipe' !== $block['blockName'] ) {
return $output;
}
// Replace the given keys with the given values.
$search_replace = array(
'Ingredients' => 'Zutaten',
'Instructions' => 'Anleitung',
'Category:' => 'Kategorie:',
);
return str_replace( array_keys( $search_replace ), array_values( $search_replace), $output );
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.