Broadcast resets post_parent
-
Hi!
We use Broadcast on a WP network with sites utilizing hierarchical page structure a lot and we do not need to broadcast parent pages, just child ones. We noticed that in this case, if we save a child page on the source site, Broadcast plugin copies its changes to linked pages on target sites but resets parent page IDs there.
I was able to trace the cause down to wp-content/plugins/threewp-broadcast/src/traits/broadcasting.php:301 where it sets ‘post_parent’ property to zero. It later tries to find the parent page ID on a target site but fails because it is not liked via Broadcast.
We just wanted to keep parent page the same and I find that if I unset new_post->post_parent property in a ‘threewp_broadcast_broadcasting_after_switch_to_blog’ action handler, then the post is getting saved w/o an error but post_parent field remains the same.While this workaround worked for us, I suggest that Broadcast logic should be changed so that other users wouldn’t be affected by the issue. I believe that if post_parent property would be unset instead of setting it to zero, this will eliminate unwanted parent reset while for posts/pages having their parents linked via Broadcast, this property would be still correctly initialized by later code.
- The topic ‘Broadcast resets post_parent’ is closed to new replies.