WordPress Ken Theme Error in Sidebar Editor - “Fatal error: Uncaught Error: Function name must be a string”

一个人想着一个人 提交于 2019-12-11 21:33:10

问题


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!

Fatal error: Uncaught Error: Function name must be a string in /home/themename/public_html/wp-content/themes/ken/framework/php/metabox-generator.php:106 Stack trace: #0 /home/themename/public_html/wp-admin/includes/template.php(1037): mk_metaboxesGenerator->render(Object(WP_Post), Array) #1 /home/themename/public_html/wp-admin/edit-form-advanced.php(686): do_meta_boxes(Object(WP_Screen), 'side', Object(WP_Post)) #2 /home/themename/public_html/wp-admin/post.php(173): include('/home/themename/p...') #3 {main} thrown in /home/themename/public_html/wp-content/themes/ken/framework/php/metabox-generator.php on line 106

/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__)) . '" />';
}

回答1:


It must be a PHP7 issue.

Try changing this:

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

To this:

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


来源:https://stackoverflow.com/questions/51274015/wordpress-ken-theme-error-in-sidebar-editor-fatal-error-uncaught-error-func

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!