I need to get blog ids (or site ids) on my multisite, from permalinks.
THIS PROBLEM IS NOT A PLUGIN SPECIFIC, but here the full story: I listed the all network posts on my multisite to my network-home's homepage with "WDS Multisite Aggregate" plugin. This works fine, and the "aggregated" post's permalink's shows to the parent post's. (thus clarifying: The child posts will link back to the parent post.)
So, I have posts on my network's home with permalinks to the subsite's posts.
I want to get from these links the publisher subsite's id, because if I know these site's ids, I can get the publisher site's homeurl, like this:
$myblogid = [MISSING CODE, wherewith I get blog id from permalink]
$mysuburl = get_home_url( $myblogid );
If I use the get_current_blog_id()
, these getting the network's home id.
I know that, possible get blog id from url thus:
$blog_id = get_blog_id_from_url("example.com", "/blog1/");
or
$blog_id = get_blog_id_from_url("blog1.example.com");
but this not working with post's permalinks, just only with blog urls.
very simplified: I have a permalink what this: subsite.network.com/post-url Now I want getting this: subsite.network.com
subsite.network.com/post-url
with the linksubsite.network.com
?