option-tree
option-tree copied to clipboard
WP CLI support
Hi there,
I'm using option tree from within the "Stratus" Wordpress theme. I'm setting up my Wordpress site using WP CLI (http://wp-cli.org) but it doesn't work because of the following error:
PHP Fatal error: Call to undefined function ot_decode() in /srv/www/themes/stratus/option-tree/theme-options-defaults.php on line 16
The problem comes from this line: https://github.com/valendesigns/option-tree/blob/master/ot-loader.php#L361
Within WP CLI, is_admin will be false but some code loaded by the theme or Option Tree itself needs those admin functions. So I replaced:
if ( ! is_admin() )
with:
if ( ! is_admin() && !defined('WP_CLI') )
and it works.
Another solution is to call WP CLI with this theme disabled:
wp --skip-themes=stratus [...]
but I'm guessing this solution won't work if Option Tree is enabled as a plugin.
Should I create a pull request for this?
Regards,
Sorry for the late reply but feel free to create a PR.