Custom Fields
Support General Can't retrieve data from my group

  • Creator
  • #32349

    I have a field group (ptm_elements) with subfields (not clonable).

    The function stops because $group = empty but it isn't. What is wrong?

    function showElement($type) {
    $group = rwmb_meta( 'ptm_elements');
    if ( empty( $group ) ) {
    return '';
    $output = '';
    $output = $group[$type] ?? '';
    return $output;

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
  • #32362
    Long Nguyen

    Hi Cees,

    You can try to pass the post ID to the helper function rwmb_meta() like this

    function showElement($type, $post_id) {
        $group = rwmb_meta( 'ptm_elements', '', $post_id);

    Refer to the documentation


    Hi Long,

    I don't understand which post_id U have to use.

    The function is placed on an element of a page (in Oxygen) and decide of it is hide or not.

    Long Nguyen


    When you call the custom function and pass the type to the group, you need to pass the post ID also. For example

    showElement( 'my-type', 12345 )

    Or you can contact Oxygen support to get the post ID and pass it to the helper function rwmb_meta().


    Please for me: why I the post-id not in the documentation here:

    Sometimes it cost me a lot of time to figure out how it works.

    Long Nguyen

    Hi Cees,

    The post ID is written down in the helper function rwmb_meta() documentation as I posted above.

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