"Add New Post" page does not show the editor
-
I found a problem in this Multisite Featured Image plugin where “Add New Post” page shows “You are currently editing the page that shows your latest posts.” instead of the editor.
Reproduce procedure:
1. Make 3 sub sites or more.
2. Go to “Add New Post” page in sub site.I looked at the source code and fixed below:
---------------------------------------- function ibenic_mufimg_save_thumbnail( $post_id ) { $currentBlogID = get_current_blog_id(); $switchCount = 0; // change to counter /*snip*/ foreach ($blogList as $blog) { if($blog["blog_id"] == $currentBlogID){ continue; } switch_to_blog( $blog["blog_id"] ); $switchCount++; // increment the counter $imgID = ibenic_mfuimg_get_attachment_id_from_url( $imgURL ); if($imgID != false){ break; } } } /*snip*/ //Change to the current blog for ($i = 0; $i < $switchCount; $i++) { // call $switchCount times restore_current_blog(); } ----------------------------------------------
switch_to_blog() has a stack (actually just an array) and pushes current blog id to the stack.
restore_current_blog() pops the stack and back to the previous blog in the switching history.
We need to call restore_current_blog() same number of times of calling switch_to_blog().
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘"Add New Post" page does not show the editor’ is closed to new replies.