Custom Fields
Re-Envisioned
Support General File advanced rwmb_meta helper, array error

  • Creator
    Topic
  • #30547

    Hello,
    when I use rwmb_meta helper to get a link for file download into Oxygen repeater. I need to get just one file.

    <?php
    $files = rwmb_meta( 'cf-den-1-ustanoveni', array( 'limit' => 1 ) );
    $file = reset( $files );
    ?>
    <a href="<?php echo $file['url']; ?>">Ustanovení</a>
    

    I get the link on the frontend just fine, but backend reports this error
    reset() expects parameter 1 to be array, string given.
    Any thoughts on this?

    Thank you.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #30555
    Long Nguyen
    Moderator

    Hi,

    That means on the backend, the helper function gets the wrong third argument $post_id. You can try to put the post ID to the helper function and re-check it.

    $files = rwmb_meta( 'cf-den-1-ustanoveni', array( 'limit' => 1 ), 1234 );
    

    Get more details on the documentation https://docs.metabox.io/rwmb-meta/#arguments

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.