I have meta box with include rule.
When I load any admin page (no edit or create form), I get the error:
E_NOTICE Trying to get property of non-object - class-mb-include-exclude.php:159
This occurs when the plugin tries to verify need show meta box with the condition include/exclude.
I think that here we can add a condition to function check() in "class-mb-include-exclude.php" to prevent this error.
public static function check( $show, $meta_box )
{
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
return $show;
$post_id = isset( $_GET['post'] ) ? $_GET['post'] : ( isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : false );
if(! $post_id) return false;
self::$post_id = (int) $post_id;
...
Or revise globally and register meta box only in the pages of editing / creating a post.
Call stack:
#11 [internal call] - MB_Include_Exclude::check_slug('contacts', Array[10])
#10 /var/www/wp-content/plugins/meta-box-include-exclude/class-mb-include-exclude.php:70 - call_user_func(Array[2], 'contacts', Array[10])
#9 /var/www/wp-content/plugins/meta-box-include-exclude/class-mb-include-exclude.php:36 - MB_Include_Exclude::maybe_exclude_include('include', Array[10])
#8 [internal call] - MB_Include_Exclude::check(true, Array[10])
#7 /var/www/wp-includes/plugin.php:213 - call_user_func_array(Array[2], Array[2])
#6 /var/www/wp-content/plugins/meta-box/inc/meta-box.php:68 - apply_filters('rwmb_show', true, Array[10])
#5 /var/www/wp-content/plugins/meta-box/inc/init.php:24 - RW_Meta_Box->__construct(Array[8])
#4 [internal call] - rwmb_register_meta_boxes('')
#3 /var/www/wp-includes/plugin.php:496 - call_user_func_array('rwmb_register_...', Array[1])
#2 /var/www/wp-admin/admin.php:145 - do_action('admin_init')
#1 /var/www/wp-admin/edit.php:10 - require_once('/var/www/wp-ad...')