Question
When I call switch_to_blog() with a blog id, I don’t know whether that blog actually exists. The function returns always TRUE. Test case: switch_to_blog( PHP_INT_MAX ); $post = get_post( 1 ); restore_current_blog(); This will result in database errors which are exposed to the user. How ...
0
, , 4 months 0 Answers 62 views

Question
how can I load switch_to_blog() function outside wordpress? $blog_id = '7'; require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' ); switch_to_blog($blog_id); echo get_option('blogname'); restore_current_blog(); echo 'You switched back.'; I get error: Fatal error: Call to a member function set_prefix() on a non-object in /home/public_html/wp-includes/ms-settings.php on line 126 Any ideas ? UPDATE It can be loaded ...
0
, 6 years 0 Answers 53 views