From 83b157829fa2c77f3952f2eb96094486a0db90bb Mon Sep 17 00:00:00 2001 From: Tom Broucke Date: Thu, 3 Nov 2022 17:56:28 +0100 Subject: [PATCH 1/2] fix for multisite --- intuitive-custom-post-order.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/intuitive-custom-post-order.php b/intuitive-custom-post-order.php index 6017120..3a4edb6 100755 --- a/intuitive-custom-post-order.php +++ b/intuitive-custom-post-order.php @@ -36,7 +36,7 @@ function hicpo_uninstall() switch_to_blog( $blog_id ); hicpo_uninstall_db_terms(); } - switch_to_blog( $curr_blog ); + restore_current_blog(); hicpo_uninstall_db_blogs(); } else { hicpo_uninstall_db_terms(); @@ -770,10 +770,9 @@ function hicpo_sites_clauses( $pieces = array() ) if ( is_admin() ) return $pieces; if ( 1 != $blog_id ) { - $current = $blog_id; switch_to_blog(1); $hicpo_network_sites = get_option( 'hicpo_network_sites' ); - switch_to_blog($current); + restore_current_blog(); if ( !$hicpo_network_sites ) return $pieces; } else { if ( !get_option( 'hicpo_network_sites' ) ) return $pieces; @@ -793,10 +792,9 @@ function hicpo_get_blogs_of_user( $blogs ) { global $blog_id; if ( 1 != $blog_id ) { - $current = $blog_id; switch_to_blog(1); $hicpo_network_sites = get_option( 'hicpo_network_sites' ); - switch_to_blog($current); + restore_current_blog(); if ( !$hicpo_network_sites ) return $blogs; } else { if ( !get_option( 'hicpo_network_sites' ) ) return $blogs; @@ -856,10 +854,9 @@ function refresh_front_network() if ( version_compare( $wp_version, '4.6.0' ) < 0 ) { global $blog_id; if ( 1 != $blog_id ) { - $current = $blog_id; switch_to_blog(1); $hicpo_network_sites = get_option( 'hicpo_network_sites' ); - switch_to_blog($current); + restore_current_blog(); if ( !$hicpo_network_sites ) return; } else { if ( !get_option( 'hicpo_network_sites' ) ) return; @@ -902,4 +899,4 @@ function get_hicpo_options_tags() } -?> \ No newline at end of file +?> From 60aa57835dc65ee74f024a729332cf235fc0aa92 Mon Sep 17 00:00:00 2001 From: Tom Broucke Date: Thu, 3 Nov 2022 18:14:59 +0100 Subject: [PATCH 2/2] removed newline and closing php tag --- intuitive-custom-post-order.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/intuitive-custom-post-order.php b/intuitive-custom-post-order.php index 3a4edb6..a3ea0dc 100755 --- a/intuitive-custom-post-order.php +++ b/intuitive-custom-post-order.php @@ -898,5 +898,3 @@ function get_hicpo_options_tags() } } - -?>