Co-Authors-Plus
Co-Authors-Plus copied to clipboard
CAP removes the Author field in bulk edit actions
Without CAP, it's possible to bulk edit post author:
With CAP active, the field vanishes and no coauthor field is added in replacement:
I think we should wait to fix this issue, here's why. I started working on a fix for that in a separate forked repo: https://github.com/psaikali/Co-Authors-Plus/commit/2ac1afbacaec965bbd35bbdd569b8eeb3c160c03
As you can see, the UI is ready.
I just need to process the bulk action when editing multiple posts, and that's where things get complicated.
The main core function taking care of this bulk editing action is bulk_edit_posts()
. Unfortunately, this function does not offer any hook to let us save additional data when bulk editing.
There is a ticket for that here and it looks like the bulk_edit_posts
hook will show up in 5.0 (very soon).
IMHO, it's better to wait for this official hook and use it to easily process the bulk-edit action and assign co-authors to multiple posts at the same time. I started to find another way to do that, by hooking to another action (wp_insert_post
is triggered by the bulk_edit_posts()
function) and checking for $_POST data, but I feel that this is a hacky way of doing things knowing that a proper hook might be available in a couple of months.
Any feedback is appreciated!
Just ran into this myself. Looks like we'll have to wait for 5.0.2 for the bulk_edit_posts to be completed.
Is this fix still in progress?
This is still an issue as of May, 2020, any update?
This would be so useful! Any word?
Also looking for this update
Bump
@psaikali are you still working on this? Otherwise I can take over and hopefully fix it for good :)
After all, it looks like the bulk_edit_posts
action won't be a thing. But it also looks like the wp_insert_post_data
hook is enough for our purpose. It does contain all the details we need to then call add_coauthors
on each post ID with given authors. This is an example var_dump
of the second argument of the action:
array (size=47)
...
'ID' => int 10673
...
'coauthorsinput' =>
array (size=3)
0 => string 'Giacomo Lana' (length=12)
1 => string 'admin' (length=5)
2 => string 'Search for an author' (length=20)
'coauthors' =>
array (size=2)
0 => string 'et-1' (length=4)
1 => string 'admin' (length=5)
'coauthors-nonce' => string '81d49936a3' (length=10)
'bulk_edit' => string 'Aggiorna' (length=8)
...
'post' =>
array (size=2)
0 => string '10673' (length=5)
1 => string '10633' (length=5)
'action2' => string '-1' (length=2)
'post_ID' => int 10673
'user_ID' => int 1
'filter' => string 'db' (length=2)
it looks to me the two entries coauthors
and post
are enough.
Tell me please, is there any news on this issue?
Tell me please, is there any news on this issue?
You can check the PR: https://github.com/Automattic/Co-Authors-Plus/pull/747 A fix was submitted, but it causes issues so, someone has to fix the fix.