Skip to content

Expand hooks for Push and Pull interfaces to support offloaded content syndication #1306

@jeffpaul

Description

@jeffpaul

Is your enhancement related to a problem? Please describe.

Summary

Building on the previous discussion in #416 and the work proposed in #417, this request expands upon the prior implementation by introducing hooks for both the Push and Pull interfaces in Distributor. This will enable greater extensibility for both internal and external connections.

Expanded Scope

The prior request focused on adding hooks within the Pull interface, allowing developers to modify and extend the content retrieval process. This issue proposes additional hooks for the Push interface, enabling similar extensibility when distributing content. By providing hooks in both syndication methods, developers can fully customize the Push and Pull functions, allowing for advanced use cases such as asynchronous processing.

Example Use Case

A potential use case for these hooks would be integrating Action Scheduler to offload the Push and Pull functions, ensuring content syndication runs in the background without blocking page loads or other critical processes. Any integration there will also need to consider UI updates for before/during/after syndication to ensure things are gracefully updated as the extended content syndication method progresses.

Proposed Hooks

To align with the prior PR’s approach, the following hooks are suggested but are open to discussion on the most optimal approach:

  • Push:

    • do_action( 'dt_before_push', $post_id, $connection ) – Fires before pushing content.
    • do_action( 'dt_after_push', $post_id, $connection, $response ) – Fires after content has been pushed.
    • apply_filters( 'dt_push_data', $data, $post_id, $connection ) – Filters push data before sending.
  • Pull:

    • do_action( 'dt_before_pull', $remote_post_id, $connection ) – Fires before pulling content.
    • do_action( 'dt_after_pull', $remote_post_id, $connection, $post_id ) – Fires after content has been pulled.
    • apply_filters( 'dt_pull_data', $data, $remote_post_id, $connection ) – Filters pulled data before processing.

Next Steps

I would love feedback from the community and maintainers on the feasibility of this enhancement and iterations on the most optimal implementation.

Finally, any future implementation should credit the following folks for participating on the earlier discussions on the topic: @avag-novembit, @arsendovlatyan, @adamsilverstein,

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs:discussionThis requires discussion to determine next steps.needs:documentationThis requires documentation.needs:engineeringThis requires engineering to resolve.

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions