WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
get_option( 'taxonomy_image_plugin' ) returns IDs off by one (3 posts)

  1. mrwweb
    Member
    Posted 2 years ago #

    When I put the following in my theme:

    <?php $type_images = get_option( 'taxonomy_image_plugin' );
    echo '<pre>';
    var_dump( $type_images );
    echo '</pre>'; ?>

    I get the output:

    array(3) {
      [41]=>
      int(200)
      [42]=>
      int(201)
      [44]=>
      int(202)
    }

    I'm confused because the IDs in this array (41,41,44) are wrong by 1. There are three terms on the site with images (40,41,43) associated with images (those image IDs are right).

    Is this the expected behavior? I can resolve the problem by subtracting one from each ID, but that makes me nervous!

    http://wordpress.org/extend/plugins/taxonomy-images/

  2. Devendra Bhandari
    Member
    Posted 2 years ago #

    I am also facing the same problem and getting wrong id by 2 i.e if the ID is 55, i am getting getting o/p 57

  3. Michael Fields
    Themer
    Plugin Author

    Posted 2 years ago #

    The Taxonomy Images plugin will store term_taxonomy_id as the key of the array. I decided not to use term_id for a very important reason: A lot of term data is shared between terms with the same name that appear in different taxonomies. I believe this may be what you are experiencing here.

    Please compare the key in the options array to the term_taxonomy_id of the term after var dumping get_terms(). If they match, the plugin is functioning correctly - if not, there may be a bug.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic