Get the first tag, but the unsorted one (2 posts)

  1. delikatesy
    Posted 6 years ago #

    I am using this script http://www.3mind.at/2009/05/06/code-highlighting/ to show related posts on my site. I have tried both solutions. One is getting the first tag, the other one is getting all tags, comparing them and showing posts which have similar tags.
    All working, but since the tags are sorted in alphabetical order, the results are ridiculous.
    I have found out, that tags are sorted in the administration area, when editing a post as well as on the website, under my posts. But tags are not sorted, when using Quick edit in admin area.
    Can somebody point me to a solution, to get only the first tag, but the onsorted one? Thanks in advance

  2. vtxyzzy
    Posted 6 years ago #

    I have not tested this, but I think you can use:
    $tags = wp_get_post_tags($post->ID,'post_tag',array('orderby' => 'none'));

Topic Closed

This topic has been closed to new replies.

About this Topic