admin管理员组文章数量:1126301
My website >> database >> wp_options >> option_name >> "cron" field total size 31GB (I was so surprised @@)
After checking i see a lot of publish_future_post fields when
My website has a lot of posts scheduled for the future, we've got a feature that periodically checks if post_status = 'future' then wp_publish_post($postID)
So publish_future_post in "cron" field is not necessary
How can I block them from automatically adding to "cron" field?
My website >> database >> wp_options >> option_name >> "cron" field total size 31GB (I was so surprised @@)
After checking i see a lot of publish_future_post fields when
My website has a lot of posts scheduled for the future, we've got a feature that periodically checks if post_status = 'future' then wp_publish_post($postID)
So publish_future_post in "cron" field is not necessary
How can I block them from automatically adding to "cron" field?
Share Improve this question asked Feb 5, 2024 at 9:22 Công Tử HuyếtCông Tử Huyết 134 bronze badges1 Answer
Reset to default 0You could hook pre_schedule_event to stop scheduling them, e.g.
function pre_schedule_event_no_publish_future_post( $result, $event, $wp_error ) {
if ( $event->hook === 'publish_future_post' ) {
// Don't schedule this event
return false;
}
return $result;
}
add_filter( 'pre_schedule_event', 'pre_schedule_event_no_publish_future_post', 10, 3 );
You could possibly remove the _future_post_hook call instead
remove_action( 'future_post', '_future_post_hook', 5, 2 );
but I think pre_schedule_event is safer.
However I'd guess there are better ways to set this up too.
本文标签:
版权声明:本文标题:database - How to disable publish_future_post auto add wp_options cron 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736663332a1946528.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论