admin管理员组文章数量:1334380
Hello and thanks in advance for any help. Im trying to update the post status from a post when submiting a comment on other post, I have a variable in the url pointing to the ID of the post I want to update like so mysite/some-post/?id=1234
Hooking into 'comment_post' wont get the variable, so a new post is created insted of updating
add_action( 'comment_post', 'aa_comment_update_post' );
function aa_comment_update_post( $comment_ID ) {
$id = $_GET['id'];
$postarr = array(
'ID' => $id,
'post_status' => 'draft',
);
wp_update_post( $postarr );
}
Any idea would be much appreciated
本文标签: Update post quotAquot on comment submition on post quotBquot
版权声明:本文标题:Update post "A" on comment submition on post "B" 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742240583a2438806.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论