Retrieving settings field values within a class

Support General Retrieving settings field values within a classResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #42081
    Rob van TuinRob van Tuin
    Participant

    I have a question, I’m building a plugin and using Meta Box. The plugin will have multiple sections so I create each section through a class, in the class I create a settings page with some text fields and I create a post type with some meta_boxes.
    Now here is my problem I want to use the text values from the settings page as the label values in the creation of the meta_box fields but I can't seem to get the values with the class or even outside the class, but on the front end it works fine. Is there a different way of getting the value on the front vs the back end?

    I’m using
    rwmb_the_value('button1', ['object_type' => 'setting'], 'SPeventSettings');
    or
    $value = rwmb_meta('button1', ['object_type' => 'setting'], 'SPeventSettings');

    Both work fine on the front end but not on the back end, how can I get the settings data with the admin pages?

    #42097
    Rob van TuinRob van Tuin
    Participant

    OK, found the answer

    instead of:
    rwmb_meta('button1', ['object_type' => 'setting'], 'SPeventSettings')
    use
    get_option('SPeventSettings')['button1']

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