WordPress.org

Support

Support » Plugins and Hacks » Hacks » Export custom post taxonomy categories

Export custom post taxonomy categories

  • Does anybody have a solution for exporting custom post taxonomy categories.

    The current Export function in tools allows the selection of a custom post type but will only export those categories associated to the posts.

Viewing 15 replies - 1 through 15 (of 28 total)
  • I’ve found one solution which is to assign all the categories to a post but with over 12,000 categories this will take a while.

    Moderator bcworkz

    @bcworkz

    “take a while” Do you mean assign manually? That’s no solution, that would take ages! You could create a script or query to collect all the category IDs into a huge array for use in wp_set_post_categories() before doing the export. It will still “take a while”, but in script time, not human time.

    You could perhaps also create your own export/import script that manipulates the tables directly with mySQL. Between the export options in phpMyAdmin and custom PHP scripts, there is certainly a way to do this. Depending on the nature of the target DB, this could be simple or complex. Of course this requires understanding how the various terms tables work together, as well as decent PHP and mySQL skills.

    hey, bcworkz

    Thanks for the response, I would do just that but I’m not a coder.

    I was hoping someone would advise me a code snippet change to splice in to export.php which selected all categories regardless of association to a post.

    I do feel this is really a wp bug. Export should export everything in the custom post taxonomy.

    <select name=”category” id=”category”>
    <option value=”all” selected=”selected”><?php _e(‘All Categories’); ?></option>
    <?php
    $categories= get_categories();

    Moderator bcworkz

    @bcworkz

    I see where you are coming from, though I would not say it is a bug, rather a feature that really should be added. But it is what it is. Adding an option on a form is easy enough, but the underlying script to handle the option is not so easy. The resulting output must work with the importer, or the importer must be modified too.

    Something could certainly be developed, but it will take some time unless one is intimately familiar with the current script. Extensive testing is required because it’s paramount everything work every time for every situation. For a one off task, one of the hacky approaches I suggested would likely be a more efficient approach.

    Since you do not have the skills, considering the volume of categories and what’s involved, it’s highly unlikely anyone will throw you a freebie script here (didn’t hurt to ask though 🙂 ). Your best recourse may be jobs.wordpress.net.

    One last thought, if the DB to receive the imported data is new or fairly minimal, and just how much you don’t want to export, you may get away with doing a export/import via myPhpAdmin. Review Moving WordPress for some details that need to be attended to when moving DBs.

    Hi and thanks for the thoughts.

    I tried exporting the custom post taxonomy categories assigned to a single post last night. Just wish I’d done a sample first, what a waist of time. Import removed the hierarchy and corrupted something to prevent re-setting parent associations to sub-categories.

    There are 10’s of plugins paid and free non that I’ve used do what I believe wordpress should do naturally.

    Export custom post type should save everything tags, taxonomies, terms, term categories associated with the custom post type – not just post items with referenced taxonomy tags and categories.

    The only safe solution was to Export All content, import to clean install and delete what was not required.

    I created a plugin for this. You can find it in http://wordpress.org/plugins/wp-export-categories-taxonomies/

    Hey timesys that’s great thank you so much for trying-

    I just loaded this plugin on wp 3.8 with the following results:

    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.

    The error log has this info >path info replaced with “……”

    20131219T163149: http://www…………../wp-admin/plugins.php

    PHP Warning: require_once(/………………/wp-content/plugins/wp-export-categories-taxonomies/includes/settings.php): failed to open stream: No such file or directory in /…………../wp-content/plugins/wp-export-categories-taxonomies/public/ect.php on line 137

    PHP Fatal error: require_once(): Failed opening required ‘/……../wp-content/plugins/wp-export-categories-taxonomies/includes/settings.php’ (include_path=’.:/

    Mmmm maybe some file was not updated properly give me 10 min and i will be with you

    Ok I released a small update fixing that. You need to go to your ftp and rename/delete the wp-export-categories-taxonomies folder to remove that error.

    Really sorry for the trouble it seems I missed the subversion upload

    Just trying Version 1.0.1 now 🙂

    Hi timesys,

    Okay I’ve tested this on wp 3.7.1 and wp 3.8
    my test was just to save the items in a custom taxonomy.

    In both of the above tests the plugin creates an xml file of 2kb called myblogwebsite.wordpress.[date].xml and does not save any data from within the taxonomy.

    Thanks for working on this issue.

    So I have a custom post type which shows as a selectable entry under the title “Taxonomies” on your plugin menu, my wp v 3.8 has about 20 items, my wp v 3.7.1 has 1000’s

    export creates the same file for both (just the server path info differs again replaced with ……)

    <?xml version=”1.0″ encoding=”UTF-8″ ?>
    <!– This is a WordPress eXtended RSS file generated by WordPress as an export of your site. –>
    <!– It contains information about your site’s posts, pages, comments, categories, and other content. –>
    <!– You may use this file to transfer that content from one site to another. –>
    <!– This file is not intended to serve as a complete backup of your site. –>

    <!– To import this information into a WordPress site follow these steps: –>
    <!– 1. Log in to that site as an administrator. –>
    <!– 2. Go to Tools: Import in the WordPress admin panel. –>
    <!– 3. Install the “WordPress” importer from the list. –>
    <!– 4. Activate & Run Importer. –>
    <!– 5. Upload this file using the form provided on that page. –>
    <!– 6. You will first be asked to map the authors in this export file to users –>
    <!– on the site. For each author, you may choose to map to an –>
    <!– existing user on the site or to create a new user. –>
    <!– 7. WordPress will then import each of the posts, pages, comments, categories, etc. –>
    <!– contained in this file into your site. –>

    <!– generator=”WordPress/3.8″ created=”2013-12-19 22:12″ –>
    <rss version=”2.0″
    xmlns:excerpt=”http://wordpress.org/export/1.2/excerpt/”
    xmlns:content=”http://purl.org/rss/1.0/modules/content/”
    xmlns:wfw=”http://wellformedweb.org/CommentAPI/”
    xmlns:dc=”http://purl.org/dc/elements/1.1/”
    xmlns:wp=”http://wordpress.org/export/1.2/”
    >

    <channel>
    <title>My Blog / Website</title>
    <link>http://www………</link>
    <description>Just another WordPress site</description>
    <pubDate>Thu, 19 Dec 2013 22:12:01 +0000</pubDate>
    <language>en-US</language>
    <wp:wxr_version>1.2</wp:wxr_version>
    <wp:base_site_url>http://www……..</wp:base_site_url>
    <wp:base_blog_url>http://www……..</wp:base_blog_url>
    <generator>http://wordpress.org/?v=3.8</generator&gt;
    </channel>
    </rss>

    Yes for some reason the files were not properly update and in the last update i just changed the one creating the fatal error. Now i uploaded all files and checked that the plugin is properly exporting the terms.

    Sorry for your time, please delete the plugin and download it again from wordpress repository

    Plugin removed and reinstalled on my wp 3.8 test site via the wp plugin repository, the plugin is still ref version 1.0.1 and continues to just save the 2kb file as above.

    Hi Smebagi, yes the plugin will still reference 1.0.1 because i updated the files in the repository.
    I just tested it with another site and it’s working fine. I check the custom taxonomy that i wanted to export and all the terms were exported successfully.

    The size of the file depends on how many terms you have to export. What do you see inside the xml?

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Export custom post taxonomy categories’ is closed to new replies.
Skip to toolbar