Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Fields

    (@mfields)

    Hello and thank you!

    This is not something that I plan on adding to the plugin, but it is definitely possible. All term/image association are stored under taxonomy_image_plugin in the options table. This is a flat array. The keys represent the term_taxonomy_id and the value represents the ID of an image. Feel free to man-handle this array as much as you like ??

    Thread Starter isay

    (@isay)

    Aha, great!
    …and the image ID corresponds to the ID in the posts table. So to get the url of the image I execute:

    SELECT  ID, guid
    FROM  wp_posts
    WHERE  ID =  '14536'
    AND  post_type =  'attachment'

    Ok, I will play around with this.

    Thanks!
    /Mike

    Plugin Contributor Michael Fields

    (@mfields)

    You can never trust the value of guid!

    There should be no need to query the database directly to return posts. Please look into using the get_posts() function.

    To return the relationships, you can use something like:

    $associations = get_option( 'term_taxonomy_id' );
    Thread Starter isay

    (@isay)

    Ok, the following worked to get the image:

    $images = get_option('taxonomy_image_plugin');
    echo wp_get_attachment_image( $images[$tax_term_id], 'medium' );

    Now I’m gonna figure out a way to update the image in a similar way…

    //Mike

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Taxonomy Images] Add image via API’ is closed to new replies.