Title: Undefined function
Last modified: August 21, 2016

---

# Undefined function

 *  Resolved [fredmat](https://wordpress.org/support/users/fredmat/)
 * (@fredmat)
 * [12 years ago](https://wordpress.org/support/topic/undefined-function-8/)
 * First, big thanks for your plugin!
 * I’m using it as plugin, and my problem is when I call ot_get_option() in my functions.
   php or any other file, PHP says that its undefined function.
 * Any idea?
 * Thanks!
 * [https://wordpress.org/plugins/option-tree/](https://wordpress.org/plugins/option-tree/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Derek Herman](https://wordpress.org/support/users/valendesigns/)
 * (@valendesigns)
 * [12 years ago](https://wordpress.org/support/topic/undefined-function-8/#post-4906706)
 * 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' );
       ```
   
 *  Thread Starter [fredmat](https://wordpress.org/support/users/fredmat/)
 * (@fredmat)
 * [12 years ago](https://wordpress.org/support/topic/undefined-function-8/#post-4906759)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/option-tree_363534.svg)
 * [OptionTree](https://wordpress.org/plugins/option-tree/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/option-tree/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/option-tree/)
 * [Active Topics](https://wordpress.org/support/plugin/option-tree/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/option-tree/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/option-tree/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [fredmat](https://wordpress.org/support/users/fredmat/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/undefined-function-8/#post-4906759)
 * Status: resolved