0

Hello All!

I got this puzzling beginner issue. It's my first Multisite install, latest versions of all, no plugins, and when I am trying to use in a page template the switch_to_blog function, I get this :

Fatal error: Call to undefined function switch_to_blog() in /SITES/Sitename/wp-content/themes/themename/page.php on line 28

with line 28 : switch_to_blog(1);

I must do something wrong, but it looks the function itself is not installed, though the function's file is there (as it should be in any normal install).

Is there a way to cleanly create the function, declare it or activate it ? I tried copy the function switch_to_blog to functions.php, and there is does not complain but is not working (i got the article from the CURRENT blog). but then error make it stop to restore_current_blog(); with the same fatal error...

I don't know where to begin... what might help you understand the issue ? THANKS in advance.

G.

  • It should be in wp-includes/ms-blogs.php, do you see it there? – Tdelang Oct 9 '16 at 7:09
  • Yes there it is... – Gesatzs Oct 9 '16 at 7:16
  • I am using MAMP 3 and 4, same result. – Gesatzs Oct 9 '16 at 20:12
  • Please edit your question to add in the relevant code. Are you calling this in an action or a filter? If so, which one? – Pat J Oct 15 '16 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.