hi i used wp_head a couple of times.I echoed some values it works like below
function test()
{
echo "hello am visible";
}
add_action('wp_head','test');
but if i store a php code in db and retrieve it to a variable and echoed it is not working, here is the sample
<?php echo "i will go to db and come again"; ?>
i stored the above value in LONGTEXT format in db as trial
then i selected the table and assigned it to a variable like below
$output = $result->trial;
Here come the problem part
function test()
{
//after retrieve
echo $output;
}
add_action('wp_head','test');
this way it is not working.i can't able to see i will go to db and come again. What is the problem? Thanks
wp_head
won't be visible in the browser. You need to view the page source (Ctrl/Cmd+U)eval()
function. Though you really shouldn't be doing this…