Get Term-ID (6 posts)

  1. mrfraz
    Posted 3 years ago #

    $meta = get_option('select_name');
    if (empty($meta)) $meta = array();
    if (!is_array($meta)) $meta = (array) $meta;
    $meta = isset($meta['77']) ? $meta['77'] : array();
    $value = $meta['select_field'];
    echo $value; // if you want to show

    How can i replace the "77" with the current term id of the site?
    Maybe someone can help me.

    thank you!

  2. kjodle
    Posted 3 years ago #

  3. kjodle
    Posted 3 years ago #

    And dude...quit duplicating posts.

  4. mrfraz
    Posted 3 years ago #


    sorry for duplicate.

    i found a solution..

    $meta = isset($meta[$term_id]) ? $meta[$term_id] : array();

    no i search help.. for "if empty"

    if (empty($meta)) {
      echo 'empty';

    doesn't work..

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    @kjodle: If you come across duplicate topics again, just add the modlook tag to one of the topics, let us know that its a duplicate (by posting that info in the topic) and a mod will be along shortly to delete the duplicates (as I did with this one).

  6. bcworkz
    Posted 3 years ago #

    Hi mrfraz,

    FYI, "empty" in PHP means something different than what it does to a linguist. It does have its uses, but isset() is what you would want to use in most cases. For more information on the differences, see http://techtalk.virendrachandak.com/php-isset-vs-empty-vs-is_null/


Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.