The example on this page is intended for limiting Tasty Links auto-linking to only the ingredients section of your Tasty Recipe cards. Use these instructions If you'd prefer Tasty Links to appear anywhere in Tasty Recipes.
Simply add the below PHP snippet to your site using a code snippets plugin:
/**
* Disable Tasty Links except for on Tasty Recipes ingredients.
*/
add_action( 'init', function() {
// Remove Tasty Links from the main post content.
remove_filter( 'the_content', array( 'Tasty_LinksFrontend', 'filter_the_content' ), 8 );
// Remove Tasty Links from Tasty Recipes description, notes, ingredients, and instructions.
remove_filter( 'tasty_recipes_the_content', array( 'Tasty_LinksIntegrationsTasty_Recipes', 'filter_tasty_recipes_content' ) );
// Remove Tasty Links from editor previews
remove_filter( 'the_editor_content', array( 'Tasty_LinksAdmin', 'filter_the_editor_content' ) );
// Add Tasty Links back, but only on ingredients.
add_filter( 'tasty_recipes_recipe_template_vars', function( $template_vars ){
if ( class_exists( 'Tasty_LinksIntegrationsTasty_Recipes' ) ) {
$template_vars['recipe_ingredients'] = Tasty_LinksIntegrationsTasty_Recipes::filter_tasty_recipes_content( $template_vars['recipe_ingredients'] );
}
return $template_vars;
});
});
Links should stop appearing anywhere in the post content outside the Tasty Recipes ingredients area.