Distributor: Post to Custom Post Type

Created on 2 Nov 2018  路  2Comments  路  Source: 10up/distributor

I see the option via show_in_rest to make custom post types is available but is there also a way to pull content between post types?

Example:
Site XYZ has a custom post type of post_type=magazine and wants to pull standard posts from Site ZYX into the magazine custom post type.

Is this scenario possible?

question

Most helpful comment

@VoltageKC In addition to the dt_pull_post_args mentioned above, there will also be a dt_available_pull_post_types filter in 1.3.5 that will allow the reverse of your scenario, where you might want to pull from a custom post type that isn't registered on the local site into a post type that is (e.g. pulling press releases into regular posts). I'm open to explorations of how you'd build this kind of functionality into the core of the plugin but the ideas I've had so far lead to pretty complex UI that seems better suited to custom code.

All 2 comments

Hey @VoltageKC,

Not tested but there are hooks in place that I think would allow this. See line 404 of includes/classes/ExternalConnections/WordPressExternalConnection.php, specifically the filter dt_pull_post_args.

In theory, this will allow you to change whatever you want about the post that will be created, including the post_type. Note that this is specific to pulling content from an external connection, but internal connections and pushing should have similar filters.

@VoltageKC In addition to the dt_pull_post_args mentioned above, there will also be a dt_available_pull_post_types filter in 1.3.5 that will allow the reverse of your scenario, where you might want to pull from a custom post type that isn't registered on the local site into a post type that is (e.g. pulling press releases into regular posts). I'm open to explorations of how you'd build this kind of functionality into the core of the plugin but the ideas I've had so far lead to pretty complex UI that seems better suited to custom code.

Was this page helpful?
0 / 5 - 0 ratings