Can you provide the configuration you’re using for this setup? I want to say that WP would be smart enough to know which site in the network it’s editing for, and use the correct posts/postmeta table at the time of saving. However, we can definitely try some tests out to see if we can recreate.
Which configuration you are talking abt ?
Multisite or CMB2 ?
Hi,
I got it.
$do_not_pass_go = (
! $this->can_save( $post_type )
// check user editing permissions
|| ( ‘page’ == $post_type && ! current_user_can( ‘edit_page’, $post_id ) )
|| ! current_user_can( ‘edit_post’, $post_id )
);
if ( $do_not_pass_go ) {
// do not collect $200
return;
}
Due t the above code its not updating the subfolder site. Currently I comment the return. I you have a feasible solution then please let me know.
The config I referred to would be the CMB2 code to set up your metaboxes.
Not sure where your code snippet above is from, my guess is core somewhere. That said, it’s possible that you’re running into a user capabilities issue more than a CMB2 issue.
But I already reset my user capabilities.
Hard to say at this point what’s going on. Would still be interested in the CMB2 config so we can try some tests and see if we can recreate the issue.
Just to be certain it’s not playing a part. What is the roll of the user being used for your attempts to save the data?
You should never edit the core files of the plugin. You are asking for trouble, and it will just break the next time you update the plugin, or install another plugin that has CMB2 bundled.
It’s best to debug the issue and resolve it correctly.
Yep, I know that updating in the core file will cause a problem. But I couldn’t found any other solution.
My role is super admin.
Here is the code.
function microlise_workshop_details() {
$prefix = ‘microlise_workshop_’;
$microlise_workshop = new_cmb2_box( array(
‘id’ => $prefix . ‘details’,
‘title’ => __( ‘Workshop Details’, ‘microlise’ ),
‘object_types’ => array( ‘workshop’ ),
‘priority’ => ‘high’,
) );
$microlise_workshop->add_field( array(
‘name’ => esc_html__( ‘Workshop Time’, ‘microlise’ ),
‘id’ => $prefix . ‘time’,
‘type’ => ‘text_time’,
‘time_format’ => ‘H:i’,
‘attributes’ => array(
‘required’ => ‘required’,
),
) );
}
add_action( ‘cmb2_admin_init’, ‘microlise_workshop_details’ );
Just tried this out in a site that has a multisite as a subdirectory. 2 sites in the network. Same setup as you have, with the exception of I used the “post” post type instead of “workshop”. Setup is added via a mu-plugin for ease of getting things set up.
Things saved just fine to the appropriate posts/postmeta in the appropriate tables. This has me thinking that there’s something specific to your current setup that is playing a part in the inability to save, more than some sort of bug with CMB2. However, I am not sure what that would be.