• Resolved D.Piyavkin

    (@piyavkin)


    Hi, Mats!

    Tack s? mycket f?r det insticksprogramet! )

    Can you give me some advice?

    1. What plugin do you recommend to use for Custom Post Type management (in combination with yours MW Taxonomy)?

    2. I have an overpopulated regular WP taxonomy (categories). I’m going to create some custom taxonomies and move there some bloated branches from existing categouries. How can I do this? To rebuild everything manually would be too painful experience.

    Thanks again for the plugin.
    And thanks for your recommendations in advance.

    With best regards,
    Dmitry Piyavkin

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Mats Westholm

    (@matswes)

    I’m sorry but I don’t know how to answer your questions. They are both good suggestions for future development of MW Taxonomy but right now I don’t know how to help you.

    You can search for custom post plugin in the directory and test your way to a plugin you find useful. Maybe the Post Type Generator could be useful if you want to build your own custom plugin or put the code in functions.php in a child theme.

    A function to convert existing categories to custom taxonomies would be possible to develop but I don’t have one now.

    Plugin Author Mats Westholm

    (@matswes)

    I wrote a post about custom plugin. Maybe you don’t need to install any plugin.

    About moving terms I’m not sure I understand the question right.

    Thread Starter D.Piyavkin

    (@piyavkin)

    Hi, Mats!

    Thanks for your reply, and many thanks for your post — it was really insightful! I’ve never thought that plugin creation may be so simple. I’m in shock (if be frankly). Will experiment with it.

    I would like to know WP internals better. But it scares me with its complexity (walls of classes, functions, etc.). Do not know where to start from. Where the ?entry point? in the subject.

    ?The wish list?

    Sure, I’m perfectly aware that you work on the project in your spare time. And I’m not waiting that you provide me (or someone else) any requested functionality immediately (or at all). I’m asking in case I miss some obvious solution or option, trying to reinvent a wheel.

    It would be great, though, if such questions happen to be useful in some way and lead you to ideas for future development.

    I think you sum up the problem quite right: ?to convert existing categories to custom taxonomies?.

    I give you an example. There are standard WP taxonomies Categories (hierarchical) and Tags (flat).

    Let’s suppose the Categories taxonomy looks like:

    Categories

    –Regions
    —-North America
    ——USA
    ——…/* all the other countries of the region */
    —-Europe
    ——France
    ——…/* all the other countries of the region */
    —-…/* other parts of the world with all the countries of the regions */

    –Industries
    —-… /* One more bloated tree of detailed UN industries classification */

    –Activities
    —-Political
    —— /* A lot of terms in the classification of political activities */
    —-Social
    —— /* A lot of terms in the classification of social activities */
    —-… /* etc./

    There are so many terms that only to scroll down the trees is a boring and time consuming task. And it looks ugly when all the related terms assigned to a single post displayed on the post’s page. Too many different classifications packed in the single Categories taxonomy — it is not good.

    The idea is to create Custom Taxonomies like:

    Custom_Taxonomy: Regions

    Custom_Taxonomy: Industries

    Custom_Taxonomy: Activities

    Custom_Taxonomy: …(etc.)

    And reassign (move) related terms from Categories into the created Custom Taxonomies. For example:

    Custom_Taxonomy: Regions
    –North America
    —-USA
    —-…/* all the other countries of the region */
    –Europe
    —-France
    —-…/* all the other countries of the region */
    –…/* other parts of the world with all the countries of the regions */

    The ideal desired functionality should provide an easy way to move any term (and its subterms if the taxonomy is hierarchical one) from one taxonomy (custom or not) to another (custom or not).

    I’ve reviewed different Custom Taxonomies plugins. It seems that no one has such functionality yet.

    As to me, I guess, it is possible to change DB directly (in phpmyadmin). But there is risk to mess up everything.

    ——————

    Excuse me for such long post.

    With best regards,
    Dmitry Piyavkin

    Thread Starter D.Piyavkin

    (@piyavkin)

    P.S. Mats, there is unfinished sentence in your post: ?In the plugin MW Taxonomy I …? Probably WP drafts/revisions system gobbled part of it.

    Plugin Author Mats Westholm

    (@matswes)

    Yes, you can do this directly in DB with phpmyadmin. I don’t know exactly how but I can find out. One great way to study wp is to have local development environment and copy the site to it. Then you can experiment, change things just to see what happens.

    I use the plugin All-in-One WP Migration to copy the site I want to work with.

    I will start thinking about how to implement this functionality with moving terms around. If no other plugin has this it be a challenge.

    One thing to consider how ever you do it is how to handle the change of url to taxonomy pages if this is indexed by search engines or linked to. You can do this with ‘rewrite’ argument when registering the taxonomy.

    About how to get to know the internals of wordpress I had to buy a book when I started to learn developing plugins. I bought Profession WordPress Design and Development. This was six years ago. All the information is really in the codex and other places on Internet but sometimes hard to find and like you say really complex.

    Thread Starter D.Piyavkin

    (@piyavkin)

    Thanks for the hints! I will try the plugin, and will experiment on localhost or some testing WP installation.

    WP internals and studying

    I was occupied in web development in the past, but since lost proficiency. Technologies moved forward significantly. The amount of new opportunities is overwhelming.

    Mats, why, by the way, you’ve chosen the WP in the first place? Why not Drupal, Laravel, JS (full stack pack) or something else?

    I’ve found the book you’ve mentioned. The book seems promising. I will try it. Thanks for the advice, again!

    As to the codex.www.remarpro.com or developer.www.remarpro.com — yes, they have a lot of information. But I can not find there a WP architecture or data base structure (data model). It complicates studying process (at least for me).

    DB tweaking

    I’m looking at DB, and see it like this.

    The relevant information about taxonomies is stored in the tables:

    termsname and slug info for all terms;

    term_taxonomy — tree hierarchy is defined here, and also term2taxonomy relation (field taxonomy).
    /* I wonder, why fields description and count are placed here, but not in the terms table? And why taxonomy defined as a string (slug?), but not as ID number? */

    Also I see, that info about categories’ hierarchies saved in the table

    options — there is a record with the option_name == category_children, which keep all (?) the parent2child relations for categories in serialized manner (probably, for speed improvement purposes? Probably, some WP functions do it automatically).

    So, I guess, minimal set of actions for moving branch from Categories to a Custom Taxonomies manually through changing DB directly should be:

    1. To find all records for moving terms in table term_taxonomy and to change field taxonomy from ?category? to newly created Custom Taxonomy slug (for example, ?industry?);
    2. To find in the same table the root term for moved branch and to change its parent field into 0 (if it is not);
    3. To move the moved branch from the record option_name == category_children of options table to record option_name == industry_children.

    Is it correct?

    /* I wonder, why there is no separate table for taxonomies description? Why taxonomies addressed by slug/name but not by ID? And where all the information about the taxonomies (core and custom ones) is stored? For custom taxonomies, I guess, it stored in the options table. But where is the description of Categories and Tags taxonomies? */

    Possible challenges

    ?One thing to consider how ever you do it is how to handle the change of url to taxonomy pages if this is indexed by search engines or linked to.?

    Yes, that could be a problem. If web site has a history. Some external and internal links could be broken. On the other hand, the problem lays mainly on the SEO part. Any content restructuring activities, which sometimes inevitable, may lead to broken links. And SEO plugins have Redirection functionality because of that. The good one should have: automatic detection of broken links, bulk actions, rules implementation, etc.

    In my situation it is desirable outcome, if all the overpopulated Categories just disappear (turn to hidden Custom Taxonomies). Shouldn’t be created in such way (as indexed Categories) from the start.

    There may be one more problem with moving terms. Other plugins, themes and functions may use category links and save the information in DB. I see multiple records in the table postmeta, which directly related to category. I guess, it’s something about Menu and some menu may be broken in result. I also see the category links in a some_theme_options record in table options (in my case the old theme isn’t used anymore, but as a possibility).

    Yep, the challenge it is. )

    Thread Starter D.Piyavkin

    (@piyavkin)

    Mats,

    I’ve added to your plugin my Review/Rating and translation in my native language (probably, should be approved somehow).
    Thanks for your help and info!

    Plugin Author Mats Westholm

    (@matswes)

    Thank you for your nice review and rating. It makes me want to keep working on the plugin but unfortunately I have to go to my regular job tomorrow so it will have to wait.

    I will get back to you about the other questions..

    Thread Starter D.Piyavkin

    (@piyavkin)

    Mats, don’t get me wrong, but by filling the review I had no intention to push you to the work or something. It’s just review in support. Sorry, if I gave you wrong impression.

    I’m going to storm the WP internals myself, and also waiting for free time from my regular occupation. When it comes it’s hard to say, but I still feel enthusiastic. )

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Moving terms from taxonomy to taxonomy’ is closed to new replies.