Support

Account

Home Forums Add-ons Options Page Display Variable on Option Page

Helping

Display Variable on Option Page

  • Hello ACF community!

    I’m looking for a correct way to use a variable that the user can set on an option on that same option page.

    Say the theme user can type in a username in an option-field and when they save their new option I would like to give them a link that is based on their username directly on the option page. In effect I need to be able to grab that variable directly on the option page and display it.

    Is there a way to create that?

    Thanks in advance!

  • add a message field “my_message_field”
    Add an acf/prepare_field filter for the message

    
    add_filter('acf/prepare_field/name=my_message_field', 'prepare_my_message_field');
    function prepare_my_message_field($field) {
      //set message based on another field
      $field['message'] = get_field('my_other_field', 'options');
      return $field;
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Display Variable on Option Page’ is closed to new replies.