I am trying to write a function that will allow me to specify a post ID and a blog ID, and then have it return the permalink and title of the blog post.

I need this to be efficient because the function will be used in a foreach loop that could cause the function to run upwards of 50 times.

Any ideas?

2 Answers
2

That sounds pretty simple.

Use: http://codex.wordpress.org/Function_Reference/switch_to_blog

To go back use:

restore_current_blog();

This allows you to switch from site to site.

Then: http://codex.wordpress.org/Function_Reference/get_permalink

My assumptions are that you have both the Blog ID and the Post ID.

If that’s the case – using those two functions should solve your problem.

Leave a Reply

Your email address will not be published. Required fields are marked *