Support Forum
Support › Meta Box Include Exclude › Fatal Error
I updated Meta Box Include/Exclude earlier today and got the following error when I trying to log in just now.
"Fatal Error: Can't use function return value in write context in ...filepath//wp-content/plugins/class-mb-include-exclude.php on line 258"
I've been able to disable the plugin and get back into my site. WordPress will not let me reactivate the plugin. "Plugin could not be activated because it triggered a fatal error."
I see you released a new version of this plugin yesterday, is it possible there is a problem in 1.0.6?
Hi, I couldn't replicate the bug. Can you post your code to register meta boxes?
I'm registering my metaboxes as a plugin. Perhaps this is contributing to the fatal error? Thank you for looking at this.
<?php
/*
Plugin Name: Metabox Instances
Version: 1.0.1
Author: Martin Schapiro
*/
function my_scholarship_styles() {
$themeVersion = wp_get_theme()->get('Version');
// Enqueue our style.css with our own version
wp_enqueue_style('plugin-scholarship-style', plugin_dir_url( __FILE__ ) . '/style.css',
array(), $themeVersion);
}
// Enqueue this theme's scripts and styles (after parent theme)
add_action('wp_enqueue_scripts', 'my_scholarship_styles', 20);
add_filter( 'rwmb_meta_boxes', 'SCHOLARSHIPPAGE_register_meta_boxes' );
function SCHOLARSHIPPAGE_register_meta_boxes( $meta_boxes ) {
$prefix = '_rw_';
// 1st meta box
$meta_boxes[] = array(
'id' => 'scholarships',
'title' => __( 'Scholarshop Applicants' ),
'post_types' => array( 'page' ),
'context' => 'normal',
'priority' => 'high',
'include' => array(
'template' => 'page-scholarshipnew.php',
),
'fields' => array(
array(
'id' => 'standard',
// Gropu field
'type' => 'group',
// Clone whole group?
'clone' => true,
// Drag and drop clones to reorder them?
'sort_clone' => true,
// Sub-fields
'fields' => array(
array(
'name' => __( 'Full name', 'textdomain' ),
'desc' => 'Format: First Last',
'id' => $prefix . 'fname',
'type' => 'text',
'class' => 'scholarship-name',
'clone' => false,
),
array(
'name' => __( 'Headshot', 'textdomain' ),
'desc' => 'Will be cropped square',
'id' => $prefix . 'headshot',
'type' => 'file_input',
'class' => 'scholarship-headshot',
'clone' => false,
),
array(
'name' => __( 'link', 'textdomain' ),
'desc' => 'full URL with http://',
'id' => $prefix . 'link',
'type' => 'text',
'class' => 'scholarship-link',
'clone' => false,
),
array(
'name' => __( 'Hometown', 'textdomain' ),
'desc' => 'eg: Tucson, AZ',
'id' => $prefix . 'hometown',
'type' => 'text',
'class' => 'scholarship-town',
'clone' => false,
),
array(
'name' => __( 'Vocal Range', 'textdomain' ),
'desc' => 'Alto, Tenor, Soprano, Baritone, Vocal Percussionist, etc.',
'id' => $prefix . 'range',
'type' => 'text',
'class' => 'scholarship-range',
'clone' => false,
),
),
),
),
);
return $meta_boxes;
}
?>
I couldn't replicate the issue. Here is my screencast:
Looks like a compatibility with PHP 5.2. I've updated the extension, please try again.
Thanks so much. The update seems to have resolved the issue.