I started writing this post to request support but, as often happens, I found the answer while putting together my question. Figured I’d share it just in case someone finds it useful.
I have custom postmeta nodes in my XML (see example below) and was having issues importing them. There were dozens of additional nodes I didn’t want and the ones I wanted could be in any position so using something like {wp_postmeta[4]} wouldn’t work consistently for all posts.
<wp_postmeta>
<wp_meta_key>
_content_author
</wp_meta_key>
<wp_meta_value>
Some name
</wp_meta_value>
</wp_postmeta>
<wp_postmeta>
<wp_meta_key>
_content_author_bio
</wp_meta_key>
<wp_meta_value>
Some bio text
</wp_meta_value>
</wp_postmeta>
// a bunch of other stuff I don't need ...
I needed to get just the wp_postmeta nodes that contained a wp_meta_key equal to the desired custom field name (in my case, _content_author or _content_author_bio) and then use the wp_meta_value.
So to get these values I entered the following in my import template, using XPath syntax…
{wp_postmeta[wp_meta_key='_content_author']/wp_meta_value}
{wp_postmeta[wp_meta_key='_content_author_bio']/wp_meta_value}
Anyway, maybe this helps someone save a bit of time. Love this plugin.
-
This topic was modified 7 years ago by
Erin Bell.