I am importing an rss feed from a job listing site and creating a post for each listing i import with wp_insert_post to save the data and display expired listings in an archive later.
I need a solution to keep wp_insert_post from creating duplicats while it still updates the post if certain values have been updated on the job listing from the feed. Each listing has its own ID called AdvertID from the feed.
Just to clearify,"if (!get_page_by_title)" wont do the trick when a lot of job listings can have the same title, so that solution ends up excluding a majority of listings. Everything works fine with the code already there, i just need a solution to the problems i am explaining. Just showing some code so you can get a sense of what i am doing here. `
$post = array( 'post_content' => $item->description, 'post_date' => $item_date, 'post_title' => $item_title, 'post_status' => 'publish', 'post_type' => 'jobs', ); $id = wp_insert_post($post); $metdata = array( 'link' => $item->link, 'date' => $item ->date, 'company_logo_path' => $item->CompanyLogoPath, 'company_profile_text' => $item->CompanyProfileText,