Make WordPress Core

Opened 9 years ago

Last modified 3 years ago

#34414 new feature request

Add extra item fields to exported WXR file

Reported by: kkarpieszuk's profile kkarpieszuk Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.4
Component: Export Keywords: has-patch dev-feedback close
Focuses: Cc:

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 9 years ago.
Proposed patch

Download all attachments as: .zip

Change History (8)

@kkarpieszuk
9 years ago

Proposed patch

#1 @swissspidy
9 years ago

  • Keywords has-patch added

#2 @kkarpieszuk
9 years ago

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

#3 @swissspidy
9 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
9 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
8 years ago

@swissspidy could we get back to this?

#6 @swissspidy
8 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.

#7 @desrosj
3 years ago

  • Keywords close added
  • Milestone set to Future Release

I'm going to add a suggestion to close as a wontfix.

I tend to agree that allowing plugins and themes to include their own XML in the file could potentially cause all sorts of problems and instability. I'm not very familiar with the internal workings of the Importer plugin either, but I would assume that without alterations to the import process as well, the additional data added to the export file would be worthless (unless there are hooks in the plugin that would allow additional processing of custom data).

I'll leave this open for a few more months to allow for additional feedback, but discussions can always continue on closed tickets as well.

Note: See TracTickets for help on using tickets.