WordPress make post sticky via script?

2020-03-30 06:27发布

    // Create post objects
    $my_post = array();
    $my_post['post_title'] = 'Main Blog Post Title';
    $my_post['post_content'] = 'Main Blog Post Content';
    $my_post['post_type'] = 'post';


    // Insert the post into the database
    wp_insert_post($my_post);

How can I make this post sticky via the script?

标签: wordpress
1条回答
Melony?
2楼-- · 2020-03-30 06:40
$post_id = wp_insert_post($my_post);
stick_post($post_id);
查看更多
登录 后发表回答