Support » Plugin: OptionTree » Undefined function

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Derek Herman

    (@valendesigns)

    OptionTree is loaded on the after_setup_theme action at priority 1. So if your theme is calling the ot_get_option() function before it’s loaded you’ll get an error message. A typical issue people run into is that they use the function inside the functions.php file before it’s available with code like:

    $my_option = ot_get_option('option_id');
    echo $my_option;

    To solve the issue you would wrap that code like:

    function my_custom_function() {
      $my_option = ot_get_option('option_id');
      echo $my_option;
    }
    add_action( 'after_setup_theme', 'my_custom_function' );

    Actually I’d like to assign a constant with options data:

    define( 'CONSTANT', ot_get_option( 'my_option' );

    and this code is at top of functions.php

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined function’ is closed to new replies.