• Hello, is there a easy way (or any way at all) to get the correct permalink for a post on a sub blog in a loop on the main blog? I made a query to extract the posts i wanted with postid and blogid but i can’t find a easy way to get the correct link without hacking the get_permalink() function to death.

    I have been googling the problem but i can’t seem to find a solution, but I can’t be the only one who have this problem?

    So i want to do something like this:
    <?=get_permalink($postid, $blogid)?>

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Using switch-to-blog or something? Yeah, it doesn’t work right :/ I used the post ID since I know domain.com/site/?p=POSTID always works.

    Thread Starter micke021

    (@micke021)

    Switch-to-blog doesn’t really feel like an alternative based on its performance in combination with the heavy traffic to the site.
    I’ll try the direct linking, should be pretty easy to do a wrapper function to generate that.
    Thanks for the help Ipstenu!

    But wordpress admins, there is really no reason why this function should not exist…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I was asking if you WERE using switch to blog… How are you getting the list then?

    Thread Starter micke021

    (@micke021)

    no, i’m using raw mysql queries to extract the post info I need.

    I think you need to get the GUID.

    Thread Starter micke021

    (@micke021)

    But the GUID won’t give me the correct permalink structure. It will only give me the same url as the previous suggestion “domain.com/site/?p=POSTID” and it will contain the wrong url if the post/page was created on my local dev machine (localhost) prior to the upload to the live server.

    So…. top-level issue here. What ultimately are you trying to do? Your OP says you’re building your own loop. To get some posts from some blogs? All posts from the sub blogs? What?

    Cuz both of those have been done, and I’m just trying to help you not beat your head off the wall here or reinvent wheels.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Getting permalink for post on sub blog’ is closed to new replies.