humanmade / WordPress-Importer

In-development rewrite of the WordPress (WXR) Importer
Other
358 stars 63 forks source link

Importer not correctly processing Elementor post meta #93

Closed colmtroy closed 7 years ago

colmtroy commented 7 years ago

Hi folks,

Just identified a possible bug - full issue described here - I originally thought it was a bug with that plugin but I've also confirmed the issue persists with WP Importer 2.0 - which the plugin in the thread below leverages.

https://wordpress.org/support/topic/elementor-metadata-not-being-applied-to-content/

If you need any further details to re-create the issue let me know.

Best,

Colm

matipojo commented 7 years ago

Hi,

It's a problem with JSON meta values. The add_post_meta removes the JSON escaped strings ( with wp_unslash).

In Elementor we added a filter for the Wordpress Importer hook wp_import_post_meta: https://github.com/pojome/elementor/blob/develop/includes/compatibility.php#L62

Thanks, Mati

colmtroy commented 7 years ago

Hey Mati,

Thanks for the fast reply - aha - any plans to add a similar filter for the new importer? I understand WP Importer 2 will eventually replace the current WordPress Importer.

Colm

matipojo commented 7 years ago

Ofcourse, we will handle it.

colmtroy commented 7 years ago

@matipojo Super - thanks!

rmccue commented 7 years ago

@matipojo Is this an issue in the Importer itself? i.e. is the Importer incorrectly slashing/unslashing here? If so, it definitely needs to be fixed here.

carstingaxion commented 6 months ago

@matipojo [...] we added a filter for the Wordpress Importer hook wp_import_post_meta

I ran into the same issue now, while using WordPress playground, which comes with this importer by default.

I'm also using wp_import_post_meta and was wondering, why my post_meta is missing on an importFile step.

But this hook is not part of this importer anymore, which is indeed a problem, that should be fixed here @rmccue .

carstingaxion commented 6 months ago

I’ll suggest adding at least a apply_filters_deprecated() call somewhere next to

/**
             * Pre-process post meta data.
             *
             * @param array $meta_item Meta data. (Return empty to skip.)
             * @param int $post_id Post the meta is attached to.
             */
            $meta_item = apply_filters( 'wxr_importer.pre_process.post_meta', $meta_item, $post_id );