当我在wordpress中点击自定义帖子类型中的发布或保存按钮时,它会显示上述错误。我使用的是单一数据库(即gls),但该数据库共享两个站点的数据。问题是,每当我更新餐厅帖子时,单击“发布”或“保存草稿”按钮后,就会出现上述错误。请帮助我。。。这是我的密码
function save_restaurant()
{
//start function save
global $wpdb;
global $gldb;
global $post;
$glpost=get_post($post->ID);
if($post->post_type == \'page\') { return; }
else if($post->post_type == \'post\') { return; }
if($post->post_type == \'restaurant\')
{ //start post type check
$restaurant = $wpdb->get_row( "SELECT * FROM `wp_restaurant` WHERE `post_id`=\'".$post->ID."\'" );
if($restaurant->post_id==$post->ID)
{ // post is exist or not
if($_POST[\'gl\']==1 && $restaurant->gl_postid!=0)
{ // chec for gl exit page and gl id exit =1 !0
$gldb->update(\'wp_posts\', array(
//elements
),
array( \'ID\' => $restaurant->gl_postid ),
array(
//element
),
array( \'%d\' )
);
$wpdb->update(\'wp_restaurant\', array(
),
array( \'post_ID\' => $post->ID ),
array(
//elements
),
array( \'%d\' ) );
}// end check for gl exit page and gl id exit =1 !0
else if($_POST[\'gl\']==1 && $restaurant->gl_postid==0)
{// check for gl exit page and gl id exit =0 !0
$gldb->insert(\'wp_posts\', array(
//elements
),
array(
//elements
)
);
$last = $gldb->get_row("SHOW TABLE STATUS LIKE \'wp_posts\'");
$glid = $last->Auto_increment-1;
$wpdb->update(\'wp_restaurant\', array(
//elements
),
array( \'post_ID\' => $post->ID ),
array(
//elements
) ,
array( \'%d\' )
);
}// ending check for gl exit page and gl id s
else if($_POST[\'gl\']==0 && $restaurant->gl_postid!=0)
{// check for gl exit page and gl id exit =0 !0
$gldb->update(\'wp_posts\', array(
//elements
),
array( \'ID\' => $restaurant->gl_postid ),
array(
//elements
),
array( \'%d\' )
);
$wpdb->update(\'wp_restaurant\', array(
//elements
),
array( \'post_ID\' => $post->ID ),
array(
//elements
),
array( \'%d\' ) );
}// ending check for gl exit page and gl id exit =0 !0
else
{// check for gl exit page and gl id exit else case
$wpdb->update(\'wp_restaurant\', array(
//elements
),
array( \'post_ID\' => $post->ID ),
array(
//elements
),
array( \'%d\' ) );
}// ending check for gl exit page and gl id exit else case
} // ending post exist or not
else
{ // else case post exist
if( $_POST[\'gl\']==1)
{ // check for gl==1
$gldb->insert(\'wp_posts\', array(
//elements
),
array(
//elements
)
);
$last = $gldb->get_row("SHOW TABLE STATUS LIKE \'wp_posts\'");
$glid = $last->Auto_increment-1;
$wpdb->insert(\'wp_restaurant\',
array(
//elements
),
array(
//elements
)
);
}// ending check for gl==1
else
{ // checki gl else
$wpdb->insert(\'wp_restaurant\',
array(
//elements
),
array(
//elements
)
);
}// checki gl else
}// ending else for post exist
}// ending else case post type check
}//ending function save