我正在使用此代码在DWQA插件中创建帖子?但是,我的主题编辑将会死。我面临的问题是什么? function my_pre_save_post($ post_id){
// check if this is to be a new post
if( $post_id != 'new' )
{
return $post_id;
}
// Create a new post
$post = array(
'post_content'=> $post_content,
'post_title' => $post_title,
'post_author' => $post_author,
'post_category' => $post_category,
'post_type' => 'dwqa-question',
'post_status' => 'draft',
'post_date' => 'date_created',
'show_in_menu' => 'post-new.php?post_type=dwqa-question',
);
// insert the post
$post_id = wp_insert_post( $post );
// update $_POST['return']
$_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );
// return the new ID
return $post_id;
}
add_filter(' acf / pre_save_post',' my_pre_save_post');
答案 0 :(得分:0)
我只是一个想法,但我没有尝试过。
您需要/添加exprtk.hpp
这样的代码:
wp-includes / query.php