Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Natasha McDiarmid
Natasha McDiarmid
11,400 Points

WordPress Import

I had to break my WP import into sections. I imported pages, posts, sliders all separately.

When I imported my posts, it did not include their associated feature images. So I deleted them all, then tried re-adding.

WordPress keeps barking at me, telling me those posts already exist, however they don't, because I currently have zero posts in my admin area.

I think I know what's happening. It's cacheing their permalinks in the database, so the import thinks they are still there when they are not.

How can I tell WP to import them overtop? I tried importing them via mySQL but I get this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '() DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' at line 1

help!

Hi Natasha,

First of all, why did you separate your DB? I mean you had any issues importing the whole DB at once?


About your posts part, How do you go about deleting your posts? Do you empty your wp_posts table? or just deleting them all from you admin panel?

Natasha McDiarmid
Natasha McDiarmid
11,400 Points

I had issues dumping the whole import. Probably due to size. So splitting it up was my only other option to get it working.

I deleted the posts via the admin panel.

2 Answers

Shawn Flanigan
PLUS
Shawn Flanigan
Courses Plus Student 15,815 Points

Natasha,

I suspect they're still in your Trash, which could cause this problem. Go to All Posts and check your trash...if they're there, empty it to clear the way for new posts with the same Post IDs.

Hope that does the trick!

Natasha McDiarmid
Natasha McDiarmid
11,400 Points

The 'trash' area isn't accessible from the panel. I've only seen that appear a moment after you delete a post, where you can click 'undo'.

Is there a general Trash area? I can't locate it.

yes there is (PS. it won't be there if you don't have any trashed posts)

http://awesomescreenshot.com/0753tuprea

Natasha McDiarmid
Natasha McDiarmid
11,400 Points

Right, so I don't have any since I'm not seeing that.

Shawn Flanigan
Shawn Flanigan
Courses Plus Student 15,815 Points

Natasha,

When you delete a post permanently from the trash, it seems to be removed completely from the database, so you shouldn't have any permalink conflicts. You could try changing the permalink structure before importing again...see if that makes a difference. Go to Settings -> Permalinks, change to something like "Numeric" and save. Then try your import. I have a feeling you'll get the same error, though, since you seem to have overlapping post-ids. I'll think about it a bit more and get back to you in a while.

Shawn Flanigan
Shawn Flanigan
Courses Plus Student 15,815 Points

You're absolutely sure you don't have any posts in the trash? Unless you explicitly opened and emptied the trash, I'd be surprised if they were gone. Having a hard time thinking of anything else that would cause this particular problem.

Just to double-check, try going to http://[your site's url]/wp-admin/edit.php?post_status=trash

Natasha McDiarmid
Natasha McDiarmid
11,400 Points

You were right, your link was more accurate. For some odd reason, the trash link that appears beside Published wasn't active the other day when I initially deleted them. Thanks!