I posted on https://github.com/10up/distributor/issues/103, however it's a closed issue, so wanted to create a new one.
I'm running into the same issue, when trying to use a different endpoint than /wp-json/. I need to pull specific posts from a CPT.
Example I'm trying to use: https://WWW.URL.COM/wp-json/wp/v2/podcast?series=123
I've registered the CPT and set: "show_in_rest" => true
I keep getting this error:

However if I just use "https://WWW.URL.COM/wp-json/" for the endpoint it connects fine.
Any help would be appreciated!
@pstamandjr I'm assuming your sites in question are different WordPress instances and not within the same multisite (as you do not need to create External Connections for sites within the same multisite). In this case, if you set the second URL you noted as the External Connection URL in the External Connection screen and the connection gets established properly, then you should see the Distributor push menu on any instances of a published CPT. Are you not seeing the Distributor menu after publishing a CPT that's been registered correctly?
@jeffpaul Yes, you are correct. They are two separate WordPress instances.
In the external connection screen I can't pass in the URL of the direct CPT. (See screenshot below)

I can hit the main /wp-json/ which validates, however when trying to pass in a direct feed (ie: "/wp-json/wp/v2/podcast?series=385" it won't validate the URL.
Thanks for help.
@pstamandjr you don't need to pass in the specific CPT URL, just the main /wp-json URL for your site you're trying to connect to. Once that /wp-json external connection is made, you should be able to go into your CPT and push published posts to your connected site. Let me know if you're not seeing the Distributor push menu in the admin bar for published posts.
Ah, ok. That makes sense. I thought you could just connect directly to a specified feed, but I'm seeing them now and can customize to pair down what gets pulled in. Thanks again!
Hey @jeffpaul, do you have any documented examples of just pulling specific Custom Post type categories? Right now the /wp-json/ pulls all posts, including the custom post type we have setup for "podcasts", however there isn't a filter to narrow down to 1 specific category.
Basically, we need to pull specific CPT categories from. (ie: /wp-json/wp/v2/podcast?series=385)
Any help would be greatly appreciated!
@jeffpaul - Follow up to see if you could help with this. :)
@pstamandjr I'll check on that and get back to you
@jeffpaul Just checking in to see if you were able to check in on this. Thank you!
@pstamandjr there's currently no way to filter to specific categories of a CPT. It sounds like #428 may be the functionality you're looking for, correct?
@jeffpaul Yes, that is what we are looking to do, more or less. Rather than allowing the categories in the dropdown list to filter, can we hide them all together? So, we only pull in posts for this one specific category.
Basically, the 2nd site we are pushing to, should only have access to these specific posts and not be able to pull in others. Does that make sense?
@pstamandjr makes sense, probably best to note on #428 so we can include a hook to support that use case when someone gets to working on 428 (and we can then close this issue in favor of that one).
@jeffpaul That would be great! Do you know when it's slated for? Any change I can beg, borrow, or steal to have it done sooner. Hahha :)
@pstamandjr the 428 issue is currently unscheduled, but sitting on our roadmap a couple releases out so its unlikely to be available in the very near future. We do offer paid customization, implementation, and support packages should that be desired; if you're interested in that send me an email ([email protected]) and we can discuss available options.
@pstamandjr after chatting with our team, there is a filter around the post types that show in that pull list: https://10up.github.io/distributor/dt_available_pull_post_types.html. 聽If you only want a specific post type to show, you can do that using that filter.
You can also pass a query param to the pull page, if you want to filter that way. 聽So a URL like wp-admin/admin.php?page=pull&pull_post_type=page would automatically select Pages as the content type (though you can still choose a different content type manually).
Let me know if that doesn't cover the CPT question from this issue, otherwise we can close out this question.
@jeffpaul thank you again for the reply. We would definitely be leaning towards the first option of filtering out the post types that pull.
I'm trying to target that filter by the example here: https://github.com/10up/distributor/pull/274 but it doesn't unfortunately filter it out. Would this still be current with the latest version?
add_filter( 'dt_available_pull_post_types', function ( $post_types, $remote_post_types, $local_post_types, $connection, $type ) {
$post_types[] = [ 'name' => 'My Custom Post Type', 'slug' => 'my-cpt' ];
return $post_types;
} );
@pstamandjr That filter is in place in the current version (was added in 1.3.5). Looking at that example, the filter is using 5 arguments but in your add_filter call, you're not specifying how many arguments are accepted (so it defaults to 1). That will throw a PHP error and may be the reason it's not working.
I just tested this on my setup to only show Pages in the filter dropdown (by default it was showing Post and Pages), and it worked:
add_filter( 'dt_available_pull_post_types', function ( $post_types, $remote_post_types, $local_post_types, $connection, $type ) {
return [
[
'name' => 'Pages',
'slug' => 'page',
]
];
}, 10, 5 );
After discussing with @pstamandjr via email, his issue has been resolved so I'm closing this issue but happy to re-open for others with a similar need. Thanks!