[wp-hackers] meta box and input field seem not to work on writing post/page
pasi.koponen at eetanet.fi
Wed Sep 16 09:58:58 UTC 2009
This is my first message in here so sorry if you have allready covered
http://codex.wordpress.org/Function_Reference/add_meta_box ) function
and usage in here and picking up PUT/GET http commands on post/page
I am fidling around with posts and pages meta box. It seems that I
cannot get <input type="hidden" ....> to work right. I have googled and
searched around and it seems that I am doing something totally wrong.
Does anybody have an idea where I am doing stuff wrong. Here is a simple
"Hello World" plugin to illustrate the problem. It seems that wordpress
is messing around in writing post/page the $_REQUEST['hellomessage'] and
$_POST['hellomessage'] variables(this might not be the correct term).
How the sample plugin works:
It first creates the meta box by adding metboxHook to wordpress
'admin_menu' hook and creates meta_box to posts side panel. The sample
plugin should send (pushing the update post button) to server(http POST)
hellomessage which is first echo:ed out by $_POST and after that with
$_REQUEST (just for testing). So basicly in the metabox there should
became text "Hello World" after submitting editing post. It seems not to
work and I am totally clueless what I am doing wrong.
Here is the sample plugin to illustrate the problem:
Plugin Name: metaboxtest
Description: testing metabox
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
add_meta_box('hellomessage', 'hellomessage', array(&
$this,'metabox'), 'post', 'side', 'high');
type="hidden" id="hellomessage" name="hellomessage" value="Hello World"
$mBox= new metaboxTest;
add_action('admin_menu', array(& $mBox, 'metaboxHook'));
More information about the wp-hackers