Trying to get value from settings page field

Support MB Settings Page Trying to get value from settings page field

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #29853
    jimimacjimimac
    Participant

    Hi

    I'm trying to use a php function to echo the value of a field on a settings page.

    The settings page ID is 'site-details'
    the field group id is 'contact-details'
    the field id is 'bookings' and it's a URL type field.

    the function I used is...

    function booking_link() {
        
    $value = rwmb_meta( 'bookings', ['object_type' => 'setting'], 'site-details' );
    echo $value;
    
    }

    Ive obviously got something wrong so any help would be great.

    #29860
    Long NguyenLong Nguyen
    Moderator

    Hi,

    If you run the function booking_link() in the admin area, it might not work because the helper function rwmb_meta() is executed later than the settings page. Please try to use the function get_option() to get settings page value.

    Refer to this topic https://support.metabox.io/topic/bug-settings-not-available-for-custom-fields/

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