WordPresss function url_to_postid() returns 0 in multisite
-
Hi All,
I am working on multisite where i am using url to retrieve the post id. This works fine when i am passing url from current blog. But when the url comes from same network site but from different blog at that time i am trying blog swictching using following snippet.
switch_to_blog($blog_id); $post_id = url_to_postid( $permalink ); restore_current_blog();
But it gives me always zero even i am switching correct blog. Anyone know any alternative for same will be happy?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WordPresss function url_to_postid() returns 0 in multisite’ is closed to new replies.