10up / distributor

Share content between your websites.
https://distributorplugin.com
GNU General Public License v2.0
618 stars 156 forks source link

Able to push and pull content from one site but not the other #1220

Closed lovestulip closed 1 month ago

lovestulip commented 2 months ago

Describe your question

Hi there! We've installed your awesome plugin on two sites. The first site allows us to push and pull content we've wanted to syndicate. Meanwhile, the second one does not have the same Post-type permissions.

We want to be able to pull content into the second site, especially because Navigating to the Distributor > Pull Content would allow us to pull content over in bulk.

Both connections are green. We need help with how to proceed!

The first site's connection looks like this: https://d.pr/i/rNUTV3

The second site's connection looks like this: https://d.pr/i/EKaKp6

Are we missing something? Please advise! Thanks so much.

Code of Conduct

jeffpaul commented 2 months ago

@lovestulip do you have any sort of security plugins active or perhaps a firewall in place via the host for either site? Those sorts of things tend to block the REST API connection that Distributor uses to syndicate content between sites.

Also worth clarifying, but I assume those are NOT two sites within a multisite network and instead separate WordPress instances, correct?

lovestulip commented 2 months ago

@jeffpaul they are both single sites! Not multisites. Correct. 😁

As for the firewall, I believe that we do have a platform-level firewall in place for the site that has restricted Post-type permissions. (The two sites are hosted on different platforms.)

So do you think that is the reason? I guess there's not much we could do about that, right?

jeffpaul commented 2 months ago

The firewall might be able to add an exception for Distributor / REST API, but you can read a bit on this from the README:

Conflicts with Security plugins - Oftentimes the communication Distributor attempts to make across sites using the REST API will be flagged by various security plugins and surreptitiously blocked. If you run into an issue like this, please reach out to the support for your security plugin and ask about getting Distributor unblocked (here is an example for doing so with Wordfence).

lovestulip commented 2 months ago

@jeffpaul Thanks for that information! I connected with our Platform host, Pressable, and they aren't seeing any site-specific firewalls. They also see that all the requests are showing a 200 response for /wp-content/plugins/distributor-stable/ and /wp-json/.

It's strange that we can pull posts and pages, but not CPTs, right? I wonder if it's something in our code. I do see that we have registered CPTs with the argument show_in_rest => true on the site that cannot push/pull select CPTs.

Do both sites need that in place?

peterwilsoncc commented 2 months ago

@lovestulip Jeff asked me to take a look at this.

I'm unable to reproduce the issue if the post types are registered on both sites using the following code.

register_post_type( 'test-cpt2', [
    'label' => 'Test CPT 2',
    'public' => true,
    'show_in_rest' => true,
] );

The only way I can reproduce the issue is by either:

Are any of these the case on one site but not the other?

lovestulip commented 2 months ago

@peterwilsoncc thanks so much! Let me look into this and see if this might be the issue. I'll report back when I have more info.

github-actions[bot] commented 2 months ago

It has been 7 days since more information was requested from you in this issue and we have not heard back. This issue is now marked as stale and will be closed in 7 days, but if you have more information to add then please comment and the issue will stay open.

lovestulip commented 2 months ago

Just noting I am awaiting a response from the partner, she said she will get back to me!

lovestulip commented 2 months ago

Just dropping a note that it seems likely the external site has not registered CPTs with the argument show_in_rest => true which could be the issue. We're still investigating.

lovestulip commented 1 month ago

Hi there! It appears the primary issue was having CPTs registered with show_in_rest => true - once that was done, we saw permissions updated like so: https://d.pr/draw/G3gCMG/

I believe there is still a need to register some of the CPTs, but it looks like that's the underlying issue. Closing this out! Thank you for your help!

peterwilsoncc commented 1 month ago

Thanks for following up to confirm, it's really helpful for maintaining the project.

Distributor generally follows the same rules as WordPress for exposing data via the rest api and there are a lot of moving parts that make it confusing.