I am trying to understand a wordpress behaviour. When I add a tag in the admin panel mysql does a sequence of queries. Essentially:

  1. update wp_terms

  2. update wp_term_taxonomy and

  3. udate wp_options with a query of this kind

    INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) 
        VALUES (
            `option_name` = VALUES(`option_name`), 
            `option_value` = VALUES(`option_value`), 
            `autoload` = VALUES(`autoload`)

Who can explain me the meaning of this string


and why there is such thing beyond wp_term and wp_term_taxonomy update?


1 Answer 1


The only really interesting (and very important) part of the 3rd query is this:

'project_location_children', 'a:7:{i:22;a:1:{i:0;i:23;}...etc...}}'

The a:n:{i:n; etc } stuff is a serialized PHP array.

WordPress - for some historical reason - keeps track of term children in one option entry per taxonomy term. The painful thing is, that a lot of people don't know or forget about this. And if you forget about this, then the only chance to actually notice this behavior is when you look at the taxonomy term list in the admin UI. There you will see missing parent/child relationships - if you look close.

Rule of thumb:

When manually importing legacy or third party data into WordPress and when mapping it to taxonomies do not forget to set and/or update this option entry!

Else the sky will fall on your head.

  • Thanx very clear. Anyway an implicit part of the question was how to update this entry?
    – emanuele
    Commented Sep 25, 2014 at 13:07
  • @emanuele I'm at the moment working on non-WP stuff and don't have a VM pulled up. Could you edit your question with the regarding queries? I don't know every WP bit out of my head. Just add a line break after a list entry in the question and intend the code lines with 8 instead of 4 spaces for proper code mark up.
    – kaiser
    Commented Sep 25, 2014 at 13:09

Your Answer

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

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