現在完美無缺。更新的代碼。謝謝newfurniturey。
function foo_options(){
global $post;
if (isset($custom['website_url']) && isset($custom['website_url'][0])) {
$website_url = isset($custom['website_url']) ? $custom['website_url'][0] : '';}
?>
<div id="foo-options">
<label>Website URL:</label><input name="website_url" value="<?php echo $website_url; ?>" />
</div><!--end foo-options-->
<?php
}
{
function update_website_url(){
global $post;
if (($post != null) && isset($_POST['website_url'])) {
update_post_meta($post->ID, "website_url", $_POST["website_url"]);
}
}
更新 code and bin。 http://pastebin.com/2ZWisprm
你的意思是引用超全局'$ _POST'而不是'$ post'嗎? –
是的,我想我的問題是相當微不足道的,熟練程序員真的很抱歉,並會使用您的鏈接作爲參考,但這個答案是現貨,並釋放了2天的搜索。 newfurniturey - 謝謝你。 – n2codes