get_permalink isn't 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?
- The topic ‘get_permalink isn't multisite aware’ is closed to new replies.