<?php
/*
Plugin Name:My Plugin
*/
function my_function($text){
if(isset($_POST["name"])) {
$name = $_POST['name'];
} else {
echo "
<form method='post' action='options.php'>
name : <input type='text' name='name'>
<input type='submit' value='submit'>
</form>
";
}
$text = str_replace('foo',$name,$text); //replace $name -> foo
return $text;
}
add_filter('the_content','my_function');
?>
==========================================================
path : /wp-content/plugins/myplugin/options.php
1. <form method=’post’ action=’options.php’>
result = Object not found!
or
2. <form method=’post’ action=’wp-content/plugins/myplugin/options.php’>
result = Fatal error: Call to undefined function add_filter() in D:\xampp\htdocs\thwordpress\wp-content\plugins\myplugin\options.php on line 23
======================================================================