How do I output add_meta_box?
-
I’m trying to create a new meta box with add_meta_box and I’m following the first example on the codex page to do it.
The meta box successfully shows up in the post edit screen, but I think I need to change “whatever” to a variable or esc attr so that the field shows the saved value if it already exists. Using the vars in that codex example, how should I change this line?
echo '<input type="text" id="myplugin_new_field" name="myplugin_new_field" value="whatever" size="25" />';
Then, how to I output the value within my theme? I think I have to use the line below but I’m not sure what to put for “my_custom_field”
echo get_post_meta($post->ID,'my_custom_field',true);
- The topic ‘How do I output add_meta_box?’ is closed to new replies.