2

As the title says, is there any way to make sure that posts from subdomains, in a Multisite Network, can use different ids?

The reason for this, is because I'm using WP Favorite Posts plugin, and whenever two(or whatever number of) posts from different subdomains/sites form the network have the same id, when adding one to favorite posts, the other, with the same id, gets added aswell, and vice-verse when removing one.

Basically, as far as I figured out how this plugin works, it adds a href to a link inside, for example, on a query of posts, that contains the handler & that post id, something like:

<a href="....?wpfpaction=add&amp;postid=1"></a>

And if the postid is the same for example on two websites on the network, if I add one, the other gets add aswell, and vice-versa.

I guess this is the expected behavior, given the fact that the posts share the same id, however, I would like to know if there's any solution or workaround, to actually make these ids be different accorss the network.

Thank you

4
  • 2
    The correct solution is to include the site ID in the list. Contact the author and ask her to make the plugin multisite compatible.
    – fuxia
    Apr 17, 2015 at 20:59
  • @toscho I did take a look on the forum, and there was someone else asking for this issue, but no answear so far(1 year ago). I wonder if something can be changed inside the plugin itself, to make this work.
    – RGLSV
    Apr 17, 2015 at 21:47
  • @toscho looking through the plugin api, and how that link gets created, I notice that it uses the $post_id to generate the action link; from you knowledge is there anyway to differentiate the post_id from the other post ids used in all blogs? I went back and forward with what you suggested, using get_current_blog_id(), to check on which blog it runs, but the outcome stays the same.
    – RGLSV
    Apr 18, 2015 at 20:29
  • 1
    There are no comments in the files, and the plugin doesn't use the regular WP APIs. I cannot say where exactly the code have to be changed, probably on many functions. This would require a major rewrite.
    – fuxia
    Apr 18, 2015 at 23:56

1 Answer 1

5

Yes. Use $post->guid instead of $post->ID.

NB: guid must be in lowercaps for it to work.

Detailed explanation here: https://wordpress.stackexchange.com/a/209832/71131

Some additional detail on the purpose of keeping $post->ID as a backup in your third-party service: https://wordpress.stackexchange.com/a/209833/71131

1
  • NB: 'guid' must be in lowercaps, or else it won't work
    – Magne
    Dec 1, 2015 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.