WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 6 months ago

#34414 new feature request

Add extra item fields to exported WXR file

Reported by: kkarpieszuk Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Export Keywords: has-patch dev-feedback
Focuses: Cc:
PR Number:

Description

Hello

I am one of WPML developers. WPML is plugin which allows user to make multilingual sites, set language information to posts etc.

Straight to the point: we want to make it available to add to exported posts/pages an information about their language. Language information is stored in our own tables, so we cannot use existing WXR <item> elements like those for taxonomies or custom fields.

It would be perfect if before closing </item> tag would be executed hookable action which will echo those additional elements, coming from plugins such our.

I am attaching proposed patch.

Example of usage:

add_action('wxr_export_item_extra_fields', 'here_wxr_export_item_extra_fields');

function here_wxr_export_item_extra_fields($post) {
	echo "<testitempost id='" . $post->ID . "' />";
}

Attachments (1)

export.diff (666 bytes) - added by kkarpieszuk 4 years ago.
Proposed patch

Download all attachments as: .zip

Change History (7)

@kkarpieszuk
4 years ago

Proposed patch

#1 @swissspidy
4 years ago

  • Keywords has-patch added

#2 @kkarpieszuk
3 years ago

Hello @swissspidy what could we do to have this patch integrated? I am quite new here

#3 @swissspidy
3 years ago

  • Keywords dev-feedback added

Thanks for pinging me!

I'm really not familiar with import/export stuff, so I would have to leave the decision for others to make here. Unfortunately there's no maintainer for the export component, so it doesn't get the love it deserves. I hope somebody stands up :)

In my opinion a general wxr_export_item_extra_fields action would be actually quite big as there are no actions currently inside the XML (except for rss2_head). I worry about people not printing valid XML in there, leading to all sorts of troubles.

For example, echo "<testitempost id='" . $post->ID . "' />"; in your example is lacking some escaping of the post ID.

#4 @kkarpieszuk
3 years ago

I worry about people not printing valid XML in there, leading to all sorts of troubles.

weel, yeah. But on the other hand, we can say the same with the results of any other wordpress filter.

Maybe do you want me to sumplement it with some data validation?

#5 @kkarpieszuk
3 years ago

@swissspidy could we get back to this?

#6 @swissspidy
3 years ago

  • Milestone changed from Awaiting Review to Future Release

Moving this to Future Release for consideration, but definitely needs feedback from other people than me.

Note: See TracTickets for help on using tickets.