How to customize data using WordPress hooks in WP? -
i have wordpress plugin displays recipe food. want customize ingredients before displaying it. i'm using plugin hook this. have create separate plugin (functions.php
) customize data before displaying. when run page ingredients array()
in customize_recipe_field($arg)
function , change ingredient using ingredient name:
$arg[$key]['ingredient'] = $data['ingredient']."-demo";` add "-demo"
after print $arg
, changes done plugin function, when displays on web page no changes done. still shows old data.
here customize function:
function customize_recipe_field($arg) { foreach ($arg $key=>$data){ $arg[$key]['ingredient'] = $data['ingredient']."-demo"; } return $arg; } add_action('recipe_field_ingredients', 'customize_recipe_field');
Comments
Post a Comment