WordPress.org

Ready to get started?Download WordPress

Forums

Export custom post taxonomy categories (29 posts)

  1. Smebagi
    Member
    Posted 1 year ago #

    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.

  2. Smebagi
    Member
    Posted 1 year ago #

    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.

  3. bcworkz
    Member
    Posted 1 year ago #

    "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.

  4. Smebagi
    Member
    Posted 1 year ago #

    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();

  5. bcworkz
    Member
    Posted 1 year ago #

    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.

  6. Smebagi
    Member
    Posted 1 year ago #

    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.

  7. Damian
    Member
    Posted 7 months ago #

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

  8. Smebagi
    Member
    Posted 7 months ago #

    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='.:/

  9. Damian
    Member
    Posted 7 months ago #

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

  10. Damian
    Member
    Posted 7 months ago #

    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

  11. Smebagi
    Member
    Posted 7 months ago #

    Just trying Version 1.0.1 now :-)

  12. Smebagi
    Member
    Posted 7 months ago #

    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.

  13. Smebagi
    Member
    Posted 7 months ago #

    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>
    </channel>
    </rss>

  14. Damian
    Member
    Posted 7 months ago #

    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

  15. Smebagi
    Member
    Posted 7 months ago #

    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.

  16. Damian
    Member
    Posted 7 months ago #

    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?

  17. Smebagi
    Member
    Posted 7 months ago #

    Okay I just tested this on the wp 3.7.1 system (there are over 20,000 category items in the custom post type taxonomy I checked -with in the plugin save settings) the xml file below is all that is generated.

    Please note: I am only selecting the one custom post type taxonomy to save, no other boxes are checked for this test.

    same as before .... are replacing my server path

    <?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.7.1" created="2013-12-20 11:36" -->
    <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 Website / Blog</title>
    <link>http://........</link>
    <description>Just another WordPress site</description>
    <pubDate>Fri, 20 Dec 2013 11:36:53 +0000</pubDate>
    <language>en-US</language>
    <wp:wxr_version>1.2</wp:wxr_version>
    <wp:base_site_url>http://......</wp:base_site_url>
    <wp:base_blog_url>http://........</wp:base_blog_url>
    <wp:term><wp:term_id></wp:term_id><wp:term_taxonomy></wp:term_taxonomy><wp:term_slug></wp:term_slug><wp:term_parent></wp:term_parent></wp:term>
    <generator>http://wordpress.org/?v=3.7.1</generator>
    </channel>
    </rss>

  18. Damian
    Member
    Posted 7 months ago #

    Selecting just one taxonomy should work fine, Im wondering if you have any other problem....

    This site is live or can you make tests? For example if you place in functions.php

    $custom_terms =  get_terms( 'your_taxonomy_name', array( 'get' => 'all' ) );
    
    var_dump($custom_terms);

    Do you see the terms there?

  19. Smebagi
    Member
    Posted 7 months ago #

    wp 3.8 test....

    I placed your code test inside the functions.php just after the "register_taxonomy" statement and before the flush_rewrite_rules();

    this is what is displayed on the admin screen:

    object(WP_Error)#178 (2) { ["errors"]=> array(1) { ["invalid_taxonomy"]=> array(1) { [0]=> string(16) "Invalid taxonomy" } } ["error_data"]=> array(0) { } }

  20. Damian
    Member
    Posted 7 months ago #

    You need to replace your_taxonomy_name with your real taxonomy there.

    To get the taxonomy name you need to look into the url for example http://local.dev/wp-admin/edit-tags.php?taxonomy=TAXONOMY_NAME&post_type=property

  21. Smebagi
    Member
    Posted 7 months ago #

    Sorry yes if I replace the 'your_taxonomy_name' with the taxonomy name I'm trying to save I do see the category data on the page amongst other info.

  22. Damian
    Member
    Posted 7 months ago #

    Well it should work then... I will have to test it on your site to see whats wrong. If you wish to give me access send me a message in my site http://wp.timersys.com

  23. Smebagi
    Member
    Posted 7 months ago #

    admin access has been granted - message sent
    Thanks and regards

  24. Damian
    Member
    Posted 7 months ago #

    The problem was the plugin/theme registering those taxonomies was using a later hook, so the taxs where not ready when the export script runned. So i moved the export action to a later hook

  25. Smebagi
    Member
    Posted 7 months ago #

    Fantastic yes I see the change on this wp 3.8 test site. - Have you updated the plugin code on the wordpress repository with this correction? if so I will retest on wp 3.7.1 with the expanded category data.

    Many thanks

  26. Smebagi
    Member
    Posted 7 months ago #

    Okay i see v 1.0.2 which has the change so I'm just about to test that now.

    Just a small point but in wp-admin you have the text

    "Choose wich taxonomies you want to export"

    wich should be "which"

    Thanks again

  27. Smebagi
    Member
    Posted 7 months ago #

    Seems there may be some limits to this type of xml export.

    I actually have just over 29,000 category items on the wp 3.7.1 test site, I'm just taking the "try again" option but this was the error encountered:

    File not found

    Firefox can't find the file at http://......../wp-admin/options.php.

    Check the file name for capitalization or other typing errors.
    Check to see if the file was moved, renamed or deleted.

  28. Smebagi
    Member
    Posted 7 months ago #

    Okay looking good now with the new v1.0.2, my remaining issues are with the hosting limitations imposed by iPage mysql hitting 'max_questions'.
    Thanks for the plugin and all your work to correct the issues we found here.

  29. Damian
    Member
    Posted 7 months ago #

    Great to hear that, it would be great if you can rate it positive so other users knows it works.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic