We have a multilingual site with 5 languages including arabic and chinese.
Because we had problem with non-roman slugs, we use this permalink structure :
/%year%/%monthnum%/%day%/%post_id%/
In the plugin, the mapping from path to post-id is done using the get_page_by_path function which is not able to find posts because this function assumes that the permalink structure contains the post_name as last path part.
In the class-ga-top-content.php file, I replaced lines 267 to 284 by this :
$id_p = url_to_postid( $url ) ;
if ( 0 !== $id_p ) {
$wppost = get_post( $id_p ) ;
}
And it works.
Regards.
https://www.ads-software.com/plugins/google-analytics-top-posts-widget/
]]>$url = "page-url"; (without hostname nor backslash)
$page = get_page_by_path($url);
returns nothing.
I checked and $get_current_blog_id returns the right number (1).
Even url_to_postid() doesn’t work.
Do I have to call some other functions to get it work with multisite?
Thank you
I’ve tried resetting permalinks to see if that made a difference but that didn’t work.
]]>I desperately need a possibility to retrieve a post-ID from an URL/Permalink.
I tried to use url_to_postid, but it does not work for not future posts (scheduled posts).
Instead, it just returns 0.
Is there another possibility?
Thanks in advance,
Holzhaus
I have a client running WPMU 2.9.1 who’s recently starting using the Domain Mapping plugin to map a domain to one of their MU blogs. Overall it’s been great. However, there’s one weird bug we’ve run into, and I haven’t been able to find guidance anywhere on how to fix it.
They have an old internally-developed plugin that uses WordPress’ url_to_postid() function (part of WP_Rewrite, though apparently a fairly obscure part) to take a URL of a post from another of their MU blogs and fetch that post’s ID.
The problem is url_to_postid seems not to like URLs that use the mapped domain. When it’s passed one of these, it returns nothing, not even a zero/null value/error code/etc.
I’ve looked high and low to see if there’s information anywhere on how the Domain Mapping plugin interacts with WP_Rewrite in general and url_to_postid in particular, but I haven’t found anything. So I figured I’d ask the experts Any ideas on ways to teach url_to_postid to respect domain-mapped URLs, or, failing that, other approaches I should use to resolve a URL into a post ID?
https://www.ads-software.com/extend/plugins/wordpress-mu-domain-mapping/
]]> I am trying to get the post id in my blog, https://intersoftpt.wordpress.com. I am using asp.net. When I started to google it, I found that we can use ReWrite API to use the function url_to_postid().
Can anyone give me an example or a snippet on how to apply that class and call that particular function in asp.net?
My scenario is to create a comment in my aspx page and automatically added in my blog as well.
Thanks in advance.
Best Regards,
Andi Santoso
I have several pages on my blog and I am wondering why automatic pingbacks do not work on pages. Trackbacks on pages work just fine, but not pingbacks from other WordPress blogs.
Example: https://sw-guide.de/wordpress/math-comment-spam-protection-plugin/
Check out the list of trackbacks and pingbacks. I know many people who have written about this page and placed a link in their blog posts however the pingbacks do not work — in one case a pingback came thru, though…
I’m using latest WP version 2.0.5 and pings are of course enabled. And I do not use any plugin that might cause this issue — at least I am not aware of that.
For posts the pingbacks are working just fine and there is nothing to complaint about.
Any help is really appreciated.
Thanks,
Michael
The data on both servers is identical (except for the urls specified in the options) They are running the same plugins.
My problem is that the rules returned by $wp_rewrite->wp_rewrite_rules() are different on the two servers. This causes url_to_postid() to fail when parsing my permalinks and I can not figure out why the rules returned would be different.
]]>