#55894 closed defect (bug) (invalid)
Where is the "wp_update_user_counts" action defined?
Reported by: | tmatsuur | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.0 |
Component: | Users | Keywords: | |
Focuses: | Cc: |
Description
Checking when the number of users is updated, we found the following statement
/wp-includes/default-filters.php : 108
add_action( 'wp_update_user_counts', 'wp_schedule_update_user_counts', 10, 0 );
The "wp_update_user_counts" function never calls the do_action function, and I do not know where the above callback function is called.
It is possible that some of the action names are defined using variables, but I could not find any description of this as far as I searched the source code.
I think you forgot to include the do_action function in the wp_update_user_counts function.
Change History (6)
#2
in reply to:
↑ description
@
2 years ago
Hi there, thanks for the ticket!
Replying to tmatsuur:
add_action( 'wp_update_user_counts', 'wp_schedule_update_user_counts', 10, 0 );The "wp_update_user_counts" function never calls the do_action function, and I do not know where the above callback function is called.
It looks like the wp_update_user_counts
action is scheduled via wp_schedule_event()
in wp_schedule_update_user_counts() and then executed via call_user_func()
in _wp_cron().
As far as I can tell, this is consistent with how other cron tasks run, e.g. wp_scheduled_auto_draft_delete
, and does not require a do_action()
call.
#3
@
2 years ago
Thanks @SergeyBiryukov
I was inadvertent.
The "wp_update_user_counts" specified in the wp_schedule_event function was the action name, not the function name.
Then the wp_schedule_update_user_counts function will call itself once every two days.
I don't think the wp_update_user_counts function is called, how is the number of users recalculated?
#4
@
2 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
It's a bit convoluted but the counts are regenerated via the wp_update_network_counts()
function, which is attached to the twice-daily update_network_counts
cron event, which is registered on admin_init
.
Related: #55890