Jump to content

Query to grab GUID's of WP Database in order they were created


Camyden74

Recommended Posts

I'm importing posts from a csv file into a wordpress database.  The upload works fine.  What I need to do after the upload is then grab a csv file of the urls that where created, in the order they were created.  For some reason it's pulling all of the posts urls in what looks to be random order. 

 

MySQL client version: 5.1.49

 

SELECT  `post_content` ,  `guid` 
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id ) 
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id ) 
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id ) 
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id ) 
WHERE e.term_id =19
ORDER BY guid ASC 

 

This gives me a great list but it is strangely random. The titles are all the same so they are appended with a number and should be in order when they post. And maybe this is the order in which the content was posted I don't know.. but shouldn't it post in the same order as my csv file?

 

results:

http://url.com/post10

http://url.com/post10

http://url.com/post100

http://url.com/post101

http://url.com/post11

http://url.com/post11

http://url.com/post111

http://url.compost112

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.