Tet banner

Custom Fields
Support General File advanced rwmb_meta helper, array error

  • Creator
  • #30547

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

    $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
  • #30555
    Long Nguyen


    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.