This is, unfortunately, impossible considering how the link data (broadcast_data) is stored, in a separate table.
Perhaps a workaround would be to add a specific tag to broadcasted posts, and search for those tags?
Thank you for your reply. Is there a hook so I can create a tag every time a post is broadcated/un-broadcasted.
Or how about hooking or adding filter in WP query so I can join your table and also filter the results?
There are several hooks.
threewp_broadcast_post_action
threewp_broadcast_broadcasting_before_restore_current_blog
For example.
Using the second one you could add a specific taxonomy during broadcast, for example.
Thanks, i’ll try it. If you know any sample code it would be helpful. I appreciate your help!
What I did was hook unto the
threewp_broadcast_broadcasting_before_restore_current_blog
and got the
$bcd = $action->broadcasting_data;
$origin_blog_id = $bcd->broadcast_data->blog_id;
$origin_post_id = $bcd->broadcast_data->post_id;
And checked for child post like this
$broadcast_data = ThreeWP_Broadcast()->get_post_broadcast_data($origin_blog_id, $origin_post_id);
$children = $broadcast_data->get_linked_children();
Then just foreach to all the children and created post_meta keys so I can filter them later using WP_Query
Looks good. I’m trying to figure out if it’s a good idea or not to move the link data into the postmeta of each post.
Haven’t come to a conclusion either way.
Yup things to consider when going in this direction is to make sure we handle un-linking/re-linking and deleting of children and update the postmeta.