函数名称必须为字符串

函数名称必须为字符串

本文介绍了侧边栏编辑器中的WordPress Ken主题错误-“致命错误:未捕获的错误:函数名称必须为字符串"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,开发人员和问题解决者,

我在所有现有页面/帖子的WordPress仪表板中都遇到了此错误.通过我的经验,我已经学习了PHP,但是当涉及到WordPress本身内的核心php文件错误时,我并不是很有经验.基于类似的帖子,这可能是PHP7的PHP版本问题,但我不确定.

主题本身可能也需要更新,但是我认为应该先进行错误修复,然后再考虑更新Ken主题.

任何帮助将不胜感激!

/home/themename/public_html/wp-content/themes/ken/framework/php/metabox-generator.php在第106行

第106行$this->$option['type']($option);

function render() {
    wp_enqueue_style('redux-css', THEME_ADMIN_ASSETS_URI . '/css/metabox.css', false, false, 'all');
    global $post;
    echo '<div class="mk-metabox-holder"><table class="form-table"><tbody>';
    foreach ($this->options as $option) {
        if (method_exists($this, $option['type'])) {
            if (isset($option['id'])) {
                $default = get_post_meta($post->ID, $option['id'], true);
                if ($default != "") {
                    $option['default'] = $default;
                }
            }
            $this->$option['type']($option);
        }
    }
    echo '</tbody></table></div>';
    echo '<input type="hidden" name="' . $this->config['id'] . '_noncename" id="' . $this->config['id'] . '_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
}
解决方案

它必须是PHP7问题.

尝试更改此内容:

$this->$option['type']($option);

对此:

$this->{$option['type']}($option);

Hello fellow developers and problem-solvers,

I have come across this error in the WordPress dashboard in all of the existing Pages/Posts. Through my experience, I have learned PHP but I am not very experienced when it comes to core php file errors within WordPress itself. Based off similar posts, this could be a PHP version issue with PHP7, yet I'm not entirely sure.

Also the theme itself may need to be updated, but I feel there should be a bug fix for this before I would consider updating the Ken theme.

Any help would be greatly appreciated!

/home/themename/public_html/wp-content/themes/ken/framework/php/metabox-generator.php on line 106

Line 106 $this->$option['type']($option);

function render() {
    wp_enqueue_style('redux-css', THEME_ADMIN_ASSETS_URI . '/css/metabox.css', false, false, 'all');
    global $post;
    echo '<div class="mk-metabox-holder"><table class="form-table"><tbody>';
    foreach ($this->options as $option) {
        if (method_exists($this, $option['type'])) {
            if (isset($option['id'])) {
                $default = get_post_meta($post->ID, $option['id'], true);
                if ($default != "") {
                    $option['default'] = $default;
                }
            }
            $this->$option['type']($option);
        }
    }
    echo '</tbody></table></div>';
    echo '<input type="hidden" name="' . $this->config['id'] . '_noncename" id="' . $this->config['id'] . '_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';
}
解决方案

It must be a PHP7 issue.

Try changing this:

$this->$option['type']($option);

To this:

$this->{$option['type']}($option);

这篇关于侧边栏编辑器中的WordPress Ken主题错误-“致命错误:未捕获的错误:函数名称必须为字符串"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 06:20