plugins – WordPress programatically inserted post not showing in authors profile


I have inserted a post programmatically in a wordpress
When viewing the post on the authors’ page, there is no post from the post that I have inserted programmatically, but when manually updating the post, it’s then working and showing properly. What will the cause and how to solve this any guide?

Code in my plugin:

        $advert_posts = array(
            'post_author' => $user_id_get,
            'post_type' => 'advert',
            'post_title' => $title[$i],
            'post_content' => $description[$i] . $listings[$i],
            'post_status' => 'publish',

        $post_id = wp_insert_post($advert_posts);
        $category_id = 877;
        $taxonomy = 'advert-category';
        wp_set_object_terms( $post_id, array( $category_id ), $taxonomy , true );

ubaid ismail 5 months 2022-06-18T06:17:53-05:00 0 Answers 0 views 0

Leave an answer