distributor
distributor copied to clipboard
adds dt_should_push_network_post action
Description of the Change
Adds filter to short circuit distribution.
How to test the Change
Simple example code to test filter.
/**
* Test
*
* @param bool $should_push Whether the post should be pushed.
* @param WP_Post $post The post object.
* @return bool Whether the post should be pushed.
*/
function test_prevent_push( $should_push, $post ) {
if ( $post->ID === 1 ) {
$should_push = false;
}
return $should_push;
}
add_filter( 'dt_should_push_network_post', __NAMESPACE__ . '\\test_prevent_push', 10, 4 );
Changelog Entry
Added filters to prevent external and internal pushes.
Credits
Props @psorensen
Checklist:
- [x] I agree to follow this project's Code of Conduct.
- [ ] I have updated the documentation accordingly.
- [ ] I have added Critical Flows, Test Cases, and/or End-to-End Tests to cover my change.
- [x] All new and existing tests pass.
@psorensen thanks for the PR! Could you please fill out the PR template with description, changelog, and credits information so that we can properly review and merge this?