Forums

[Plugin: Media Tags] do not understand some of the functions you provide (2 posts)

  1. mkormendy
    Member
    Posted 2 years ago #

    I have the ID of an attachment, and I am trying get the tag name (or tag names) for it.
    How do I do this with ANY of your functions?
    None of them are even remotely helpful for this from what I can see.

    http://wordpress.org/extend/plugins/media-tags/

  2. pmenard
    Member
    Posted 2 years ago #

    @mkormendy

    Thanks for writing. I'm the author of the plugin and here to answer your question.

    Not directly using any of the functions I've provided via the Media-Tags plugin. This is on purpose as I've tried not to duplicate what is offered via the core WordPress functions.

    So with that being said how would you get the Media-tag tags for a given attachment? Use the WP function

    get_the_terms( $id = 0, $taxonomy ).

    The first is the attachment ID. The second is the taxonomy and should be literally 'MEDIA_TAGS_TAXONOMY'

    For example your attachment ID is 45. Then the function would be:

    $my_terms = get_the_terms(45, MEDIA_TAGS_TAXONOMY);

    The $my_terms will be an array of the media-tags. You will need add some extra coding to build the output.

    Alternately, if you want the comma-seperated list of media-tags for a given item you can call a different WP function

    get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' )

    Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags