WordPress-Importer icon indicating copy to clipboard operation
WordPress-Importer copied to clipboard

Add wp_import_existing_post filter from Trac #33721

Open westonruter opened this issue 10 years ago • 10 comments

See https://core.trac.wordpress.org/ticket/33721

westonruter avatar Nov 18 '15 05:11 westonruter

Looks good! This does cause extra sets on the $this->exists array though, any thoughts on the performance of that with lots of posts?

rmccue avatar Nov 18 '15 05:11 rmccue

I'm not familiar enough with the new codebase to speak to performance, but this patch has been applied to the existing WordPress Importer plugin on WordPress.com and we're using it successfully there.

westonruter avatar Nov 18 '15 05:11 westonruter

Specifically, if I call post_exists twice with the same data, the second one will set the same key on the array again. The array we're talking about is potentially massive, as it's every GUID => ID on the site, so writing unnecessarily to that may cause terrible performance.

(In the old importer, the array is only the posts imported so far.)

rmccue avatar Nov 18 '15 05:11 rmccue

Also, in keeping with the new naming scheme, this should be wxr_importer.post_exists instead.

rmccue avatar Nov 18 '15 11:11 rmccue

this should be wxr_importer.post_exists instead.

Why are you using . in your filter names?

danielbachhuber avatar Nov 18 '15 16:11 danielbachhuber

The wp_import_existing_post name is specifically for compatibility with the existing WordPress Importer plugin form which this patch is supposed to be committed.

westonruter avatar Nov 18 '15 20:11 westonruter

Why are you using . in your filter names?

Because it looks nice. :)

The wp_import_existing_post name is specifically for compatibility with the existing WordPress Importer plugin form which this patch is supposed to be committed.

It's not actually merged into the original Importer though, right? For new filters, I'd like to stick to the new style prefixes.

rmccue avatar Nov 19 '15 01:11 rmccue

@rmccue it has now been merged into the original Importer 😄

https://core.trac.wordpress.org/ticket/33721#comment:12

westonruter avatar May 03 '16 21:05 westonruter

Ready to go in my opinion.

swissspidy avatar May 23 '16 17:05 swissspidy

Worth noting that it has been added to the original importer for version 0.6.2 which was released, but then the release was canceled again. So we could probably use the new style prefix for it here.

swissspidy avatar Jul 10 '16 12:07 swissspidy