0

I have a MySQL table which I created that contains fields for a Title and a Body. There about 100 records in this table. I would like to create a Wordpress post for each row in this table. Is that possible with a plugin? I was thinking I could use the email to post feature but it seems like a workaround. Ideally I would like this process to be repeatable through a Cron job IE: every night import the new posts. Thank you!

-1

yes that's possible, you can create your custom post type and use MySQL query to fetch from csv file, and use insert into post function within the loop. you can use LOAD DATA INFILE query to fetch from excel and then use wp insert post function to insert into db. the query will look like:-

LOAD DATA LOCAL INFILE 'abc.csv' INTO TABLE abc
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' 
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(col1, col2, col3, col4, col5...);
3
  • Do you happen to know what the MySQL query would look like? I don't need to fetch from CSV just get the data from a MySQL table. Thank you!
    – AAA
    Sep 8 '15 at 10:50
  • I have updated my ansqwer please check
    – dev
    Sep 8 '15 at 13:23
  • Keep in mind I am converting from a MySQL table and not a CSV. How does it actually make a post? What tables am I inserting to? Thank you
    – AAA
    Sep 9 '15 at 10:53

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.