I want to update my postcontent with $wpdb

When I post a post to my site though webapi,there already had a same post_title in my post list, So I just want to updat

When I post a post to my site though webapi,there already had a same post_title in my post list, So I just want to update my post_content or replace all data to the old post but not let wp create a new post which post_name became post_name-1.

I got this code with wpdb, but it's not work, please help me, thank you guys!

$checkTitle = true;    
if($checkTitle)
            {
        $post_title = trim(hm_strip_slashes($post_title));
        $sql = "SELECT `ID` FROM $wpdb->posts WHERE `post_title` = '$post_title'";
        $t_row = $wpdb->query($sql);
        if($t_row) {$wpdb->get_results("update $wpdb->posts set `post_content` = $post_content WHERE `post_title` = $post_title");};
            }

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745489023a4629901.html

相关推荐

  • I want to update my postcontent with $wpdb

    When I post a post to my site though webapi,there already had a same post_title in my post list, So I just want to updat

    10小时前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信