Making Posts in WP with SQL Query (Published and Scheduled)
-
Hey fellas,
I am new to this website; I used to be a web developer 10 years ago but left in 2008 and now returned back to not exactly web development but blogging. My website offers daily newspapers. I have to post them on daily basis or make scheduled posts with WP which takes alot of time. Since I was a web developer so I remember that if we code proper SQL Queries and save them in text files; what we have to do every month is just replace the ‘publish date’ to the current month and run the query which in 1 go can make dozens of posts publish or schedule. I figured out all important points such as making posts in _posts tables and then also making an entry in _term_relationships to give every article their respective category. Now the issue I have is as followed. When I want to make a ‘published’ post in the SQL Query using the code below; it works perfectly fine:
INSERT INTO
general1
.wp_posts
(ID
,post_author
,post_date
,post_date_gmt
,post_content
,post_title
,post_excerpt
,post_status
,comment_status
,ping_status
,post_password
,post_name
,to_ping
,pinged
,post_modified
,post_modified_gmt
,post_content_filtered
,post_parent
,guid
,menu_order
,post_type
,post_mime_type
,comment_count
) VALUES (NULL, ‘1’, ‘2015-10-02 23:50:00.000000’, ‘2015-10-02 19:50:00.000000’, ‘test post to make it publish right away’, ‘test post to make it publish right away’, ”, ‘publish’, ‘open’, ‘open’, ”, ‘test-post-publish-right-away’, ”, ”, ‘0000-00-00 00:00:00.000000’, ‘0000-00-00 00:00:00.000000’, ”, ‘0’, ”, ‘0’, ‘post’, ”, ‘0’);But when I wish to make a schedule post and I use the code below; it does go under schedule posts but is not posting at the prefixed time. The code I use to schedule a post is below:
INSERT INTO
general1
.wp_posts
(ID
,post_author
,post_date
,post_date_gmt
,post_content
,post_title
,post_excerpt
,post_status
,comment_status
,ping_status
,post_password
,post_name
,to_ping
,pinged
,post_modified
,post_modified_gmt
,post_content_filtered
,post_parent
,guid
,menu_order
,post_type
,post_mime_type
,comment_count
) VALUES (NULL, ‘1’, ‘2015-10-02 23:55:00.000000’, ‘2015-10-02 19:55:00.000000’, ‘test post to make it publish at 23:55 local time’, ‘test post to make it publish at 23:55 local time’, ”, ‘future’, ‘open’, ‘open’, ”, ‘test-post-publish-later’, ”, ”, ‘0000-00-00 00:00:00.000000’, ‘0000-00-00 00:00:00.000000’, ”, ‘0’, ”, ‘0’, ‘post’, ”, ‘0’);Please help me out. I figured out everything. The only problem I have is that I need SQL Query which will put a post in schedule and will post it automatically at the time specified.
Looking forward for help. Thank you.
- The topic ‘Making Posts in WP with SQL Query (Published and Scheduled)’ is closed to new replies.