WordPress.org

Ready to get started?Download WordPress

Forums

Get Term-ID (6 posts)

  1. mrfraz
    Member
    Posted 12 months ago #

    <?php
    
    $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
    Member
    Posted 12 months ago #

  3. kjodle
    Member
    Posted 12 months ago #

    And dude...quit duplicating posts.

  4. mrfraz
    Member
    Posted 12 months ago #

    hey,

    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 12 months 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
    Member
    Posted 12 months 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/

    -bc

Reply

You must log in to post.

About this Topic

Tags

No tags yet.