Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
291 stars 204 forks source link

Reduce dependency on action_init_late #117

Open cfg opened 11 years ago

cfg commented 11 years ago

Recently we had an issue where code was running during init at a priority lower than 100 (when action_init_late runs) and the CA+ author taxonomy didn't exist. Because that author taxonomy didn't exist, and we ran into some cache corruption issues.

Do you think it's worth registering that CA+ taxonomy earlier, maybe at init::9 so it can be activated for selected built-in post types, and then at init::100 scanning for custom post types and optionally re-registering the custom taxonomy to update it for any custom post types?

The main benefit would be preventing the race condition for standard post types, and the majority of developers wouldn't have to be concerned with init code causing author detection issues.

Downsides seem to be minimal: a little extra code complexity, and the extra register_taxonomy call (although that could be limited to only running when $coauthors_plus->supported_post_types has changed).

I'm happy to submit a pull request.

danielbachhuber commented 11 years ago

Thanks Corey. I'd be open to checking out a pull request, although it probably won't happen until later next week. Your approach seems reasonable.

On Mar 25, 2013, at 9:09 AM, Corey Gilmore notifications@github.com wrote:

Recently we had an issue where code was running during init at a priority lower than 100 (when action_init_late runs) and the CA+ author taxonomy didn't exist. Because that author taxonomy didn't exist, and we ran into some cache corruption issues.

Do you think it's worth registering that CA+ taxonomy earlier, maybe at init::9 so it can be activated for selected built-in post types, and then at init::100 scanning for custom post types and optionally re-registering the custom taxonomy to update it for any custom post types?

The main benefit would be preventing the race condition for standard post types, and the majority of developers wouldn't have to be concerned with init code causing author detection issues.

Downsides seem to be minimal: a little extra code complexity, and the extra register_taxonomy call (although that could be limited to only running when $coauthors_plus->supported_post_types has changed).

I'm happy to submit a pull request.

— Reply to this email directly or view it on GitHub.

rebeccahum commented 7 years ago

Hi @cfg, thanks so much for your contribution! Are you able to submit a pull request for this patch you have described?