Title: get_permalink isn&#039;t multisite aware
Last modified: August 20, 2016

---

# get_permalink isn't multisite aware

 *  Resolved [salientdigital](https://wordpress.org/support/users/salientdigital/)
 * (@salientdigital)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/)
 * I have a network of 15 sites, running Domain Mapper for each at its own unique
   URL. Say DomainA.com is my default domain and I have DomainB.com through DomainO.
   com.
 * I have a custom contact form widget that generates its action attribute like 
   so:
 *     ```
       <form id="contact_widget" method="post"
       action="<?php get_permalink(get_page_by_title('Send Contact')->ID) ?>">
       ```
   
 * which works only on the default site…
 * In short I just discovered that get_permalink ignores the multisite domain that
   it is on, get_page_by_title only looks in wp_posts (not the domain’s wp_2_posts
   or wp_3_posts, etc.
 * How do I get a permalink for a post title ‘Send Contact’ on the same domain I
   am on within a multisite, or a permalink to a post on another site in the network?
 * It doesn’t seem possible without writing my own SQL to find the post manually
   with something like
 *     ```
       $table = "wp_".get_current_blog_id()."_posts";
       ```
   
 * It seems this would be a useful feature and I am rather surprised it is missing…
   any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/#post-2315933)
 * That’s not correct… Get_permalink should be aware, unless you’re calling it from
   a separate site.
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/#post-2316068)
 * Your code is incorrect.
 *  Thread Starter [salientdigital](https://wordpress.org/support/users/salientdigital/)
 * (@salientdigital)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/#post-2316070)
 * Yeah – weird. After restarting Apache it worked fine :-/
 *  [affilisites](https://wordpress.org/support/users/affilisites/)
 * (@affilisites)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/#post-2316224)
 * I have a related problem. When I try switch_to_blog() to the main site and then
   get_permalink or directly with just get_blog_permalink() I get the URL without
   the /blog prefix that the main site is supposed to have.
    This only happens when
   I try to access a permalink for the main blog from a different blog, but when
   calling it from within the main blog it works okay.
 *  [affilisites](https://wordpress.org/support/users/affilisites/)
 * (@affilisites)
 * [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/#post-2316225)
 * I just realized, the issue above only happens with custom post types, regular
   posts seem to be fine.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘get_permalink isn't multisite aware’ is closed to new replies.

## Tags

 * [multisite](https://wordpress.org/support/topic-tag/multisite/)
 * [permalink](https://wordpress.org/support/topic-tag/permalink/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 5 replies
 * 4 participants
 * Last reply from: [affilisites](https://wordpress.org/support/users/affilisites/)
 * Last activity: [14 years, 8 months ago](https://wordpress.org/support/topic/get_permalink-isnt-multisite-aware/#post-2316225)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
