我有一个名为\\u my\\u description的自定义字段
其想法是,当提交表单时,表单中的数据也会被放入该字段。
这是我的密码
add_action( \'gform_post_submission_10\', \'set_post_content\', 10, 2 );
function set_post_content( $entry, $form ) {
$post = get_post( $entry[\'post_id\'] );
$post-> _my_description = $entry[1] . \', \' . $entry[11] . \', \' . $entry[14] . \', \' . $entry[13] . \', \' . $entry[12] . \', \' . $entry[16] . \', \' . $entry[15] . $entry[19];
update_post_meta( $post );
}
如果我用wp\\u update\\u post将其转到post\\u内容,效果会很好,但如果试图将其转到自定义字段,则不会起作用。这些字段是使用此插件创建的http://justcustomfields.com/有人知道为什么这行不通吗?修复了,谢谢,如果以后有人需要该代码,请点击此处
add_action( \'gform_post_submission_10\', \'set_post_content\', 10, 2 );
function set_post_content( $entry, $form ) {
$post = get_post( $entry[\'post_id\'] );
update_post_meta( $post->ID, \'_my_description\', $entry[1] . \', \' . $entry[11] . \', \' . $entry[14] . \', \' . $entry[13] . \', \' . $entry[12] . \', \' . $entry[16] . \', \' . $entry[15] . $entry[19] );
}