0

We're importing an eXtended RSS file generated by WordPress thru the native Importer:

Tools: Import in the WordPress admin panel

Importing parent posts is straightforward, by defining the respective parent id:

<wp:post_parent>1</wp:post_parent>

However, during the export the hierarchy of categories, subcategories and so on gets lost, and we're trying to set the according parent categories inside xml file. We've tried the following without any success:

<category domain="docs_category" nicename="category-1"><![CDATA[Category]]></category>

And for another post:

<category domain="docs_category" nicename="subcategory-1" parent="category-1"><![CDATA[Subcategory]]></category>

We cannot find any explicit documentation regarding build of such Wordpress RSS file.

Could someone please point out a link to the documentation on Wordpress?

Moreover, the closest example we've found was on GitHub:

<wp:category>
        <wp:term_id>2</wp:term_id>
        <wp:category_nicename><![CDATA[test-category-1]]></wp:category_nicename>
        <wp:category_parent><![CDATA[]]></wp:category_parent>
        <wp:cat_name><![CDATA[Test Category 1]]></wp:cat_name>
</wp:category>
<wp:category>
        <wp:term_id>3</wp:term_id>
        <wp:category_nicename><![CDATA[test-subcategory-1]]></wp:category_nicename>
        <wp:category_parent><![CDATA[test-category-1]]></wp:category_parent>
        <wp:cat_name><![CDATA[Test Subcategory 1]]></wp:cat_name>
</wp:category>

We're not working with the taxonomy domain="category", but wp:category_parent sets us on the right path.

The question is:

How to set the correct parent category for each channel item, i.e. each unique post individually?

Thanks in advance for any help on this kind of urgent matter!

1 Answer 1

1

The following code snippet did the trick:

<wp:term>
    <wp:term_id><![CDATA[1]]></wp:term_id>
    <wp:term_taxonomy><![CDATA[category]]></wp:term_taxonomy>
    <wp:term_slug><![CDATA[test-category-1]]></wp:term_slug>
    <wp:term_parent><![CDATA[]]></wp:term_parent>
    <wp:term_name><![CDATA[Test Category 1]]></wp:term_name>
</wp:term>
<wp:term>
    <wp:term_id><![CDATA[2]]></wp:term_id>
    <wp:term_taxonomy><![CDATA[category]]></wp:term_taxonomy>
    <wp:term_slug><![CDATA[sub-category-1]]></wp:term_slug>
    <wp:term_parent><![CDATA[test-category-1]]></wp:term_parent>
    <wp:term_name><![CDATA[Sub Category 1]]></wp:term_name>
</wp:term>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.