I have a HTML table that I am concatenating like this:
$admin_table_output .= "Item Description: </td><td>";
$admin_table_output .= "<input type='text' name='name' value='$name'></td><td> (Optional)</td></tr><tr><td colspan='4'>";
$admin_table_output is echo'ed out at the end. That works just fine.
My problem is that I want to use apply_filters to modify the variable $admin_table_output like so:
$admin_table_output .= "Item Description: </td><td>";
apply_filters('tabs_page_static_value',$admin_table_output);
$admin_table_output .= "<input type='text' name='name' value='$name'></td><td> (Optional)</td></tr><tr><td colspan='4'>";
Using a hook like this:
function tabs_page_static_value_filter($admin_table_output) {
$admin_table_output .= 'testing';
return $admin_table_output;
}
add_filter('tabs_page_static_value','tabs_page_static_value_filter',10,1);
However this does not work. I've also tried using do_action instead, I've tried to echo the variable instead of return it and also not concatenating inside the hook.
I'm thinking I might need to do some kind of a variable variable thing to solve this problem. Any ideas?
&$
thing... but you should've assigned the filtered value back to the$admin_table_output
variable. I.e.$admin_table_output = apply_filters('tabs_page_static_value',$admin_table_output);
.