• After upgrading to WordPress 4.7 OptionTree is no longer working.

    I am using two functions from OptionTree (ot_register_meta_box and ot_get_option). This is an example of how I am using them:

    
    $metabox_cta = array(
    ... stuff here
    );
    
    if(function_exists('ot_register_meta_box')) {
        
            ot_register_meta_box($metabox_cta);
    
        }

    and:

    <a class="navbar-brand" href="<?php echo home_url(); ?>">
                    <img src="<?php if(function_exists('ot_get_option')) { echo ot_get_option('logo'); } ?>" alt="Site name">
                </a>

    Both of these fail the “function_exists” check and produces no output. They worked just fine on WordPress v4.6.1 though.

    This is how I am pulling OptionTree into my theme:

    add_action('after_setup_theme', 'mytheme_setup');
    
    function mytheme_setup() {
    
        // Load translation
        load_theme_textdomain('mytheme', get_template_directory() . '/languages');
    
        // Load OptionTree
        require(trailingslashit(get_template_directory()) . 'option-tree/ot-loader.php');
    
        // Load OptionTree settings
        require(trailingslashit(get_template_directory()) . 'assets/php/theme-options.php');
    
        // Load meta boxes
        require(trailingslashit(get_template_directory()) . 'assets/php/meta-boxes.php');
    	
    	...other stuff

    I am using OptionTree v2.6.0.

    Please advise on how to correct this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there. I’m facing the same problem. It’s probably not the best way to fix it, but decreasing the priority of after_setup_themehook in ot-loader.php is somehow fixed my problem.

    ot-loader.php – line 51:

        public function __construct() {
    
          /* load languages */
          $this->load_languages();
    
          /* load OptionTree */
          /* Priority was 1 but I changed it to 11. It doesn't work priority below 10. Go figure out! */
          add_action( 'after_setup_theme', array( $this, 'load_option_tree' ), 11 );
    
        }

    Hi there, I just get a blank screen. Try the above and doesnt work. Any news on this plugin working in 4.7.2?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not working on WordPress v4.7’ is closed to new replies.