Skip to content

getOption in add_filter() #2

@lucasmg-dev

Description

@lucasmg-dev

I want to get the value of an option in the filter template in my plugin, but I get the following error: "Titan Framework Error: Wrong usage of getOption, this should be called inside a hook or from within a theme file."

    <?php

    $titan = TitanFramework::getInstance( PLUGIN_NAME );

   // Create panels, options, etc. 

    function load_mobile_theme($theme) {
        global $titan;
        [...]
        return $titan->getOption('mobile_theme');
    }

    add_filter('template', 'load_mobile_theme');
    add_filter('option_template', 'load_mobile_theme');
    add_filter('option_stylesheet', 'load_mobile_theme');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions