Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for term meta data #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add support for term meta data #106

wants to merge 2 commits into from

Conversation

stephenharris
Copy link

WordPress 4.4 adds term meta data, and trac ticket 34602, adds term meta data to the WXR export file. Although that ticket is still open, and is unlikely to be in 4.4, this PR adds support for importing term meta data, following the schema set out in that ticket.

This PR replaces #18

@stephenharris
Copy link
Author

If wxr_importer.pre_process.term_meta returns a false-y value all subsequent term meta is skipped, not just the current one. This doesn't seem to me to be the intended behaviour, but is consistent with how the corresponding hooks for post meta and comments currently work.

If that is indeed a bug then I'm happy to open another PR to fix that, and modify this one accordingly.

* @param array $meta_item Meta data. (Return empty to skip.)
* @param int $term_id Term the meta is attached to.
*/
$meta_item = apply_filters( 'wxr_importer.pre_process.term_meta', $meta_item, $term_id );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Continuing from #18 (comment)

I think the term_id is different to the term data, so we can't just pass term.

// export gets meta straight from the DB so could have a serialized string
$value = maybe_unserialize( $meta_item['value'] );

add_term_meta( $term_id, $key, $value );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these need to be slashed?

@rmccue
Copy link
Member

rmccue commented Mar 8, 2017

Agreed, I think it should be a continue not a return

… should skip the current term meta, not all subsequent term meta.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants