I want to use the following code inside the Wordpress textarea :
if(get_post_meta($post->ID, "embed", true)):
echo ' ';
endif;
How can I do it ?
What textarea is it exactly? The one from writing a new article?
If you're trying to use it there you could define your php as a shortcode in your functions.php and use the shortcode in the textarea afterwards.
http://codex.wordpress.org/Function_Reference/add_shortcode
And I guess there are plugins to execute php in articles but I don't think it's recommendable.
Use the normal php syntax for this <?php //....code.... ?>
For PHP in TXT widgets :
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
add_filter('widget_text','execute_php',100);
Inside the Editor, just use normal php code ( <?php //my_code ?>
) but make sure you are in text mode
not visual mode