I have an external database besides WordPress which has a table with genealogical data. In WordPress, I have created a Custom Post Type (CPT) and for these genealogical records. There is also a related custom field belonging to the CPT post.

Now I am looking for the code to auto-create these CPT posts and fill the custom field with an URL; one per row in the external database. How can this be accomplished with wp_insert_post?

  • For sake of completion: the number of rows in the external database is ~800 and might grow to 1000+. The creation would be done 2-3x per year, and like to add the code into and deactived plugin for this housekeeping activity. – mzurhorst Jul 5 '17 at 21:03
  • 1
    Read the function complete details wp_insert_post – Den Isahac Jul 5 '17 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.