WC_Post_Types::flush_rewrite_rules
Flush rewrite rules.
While WordPress is installing, the registration graph can be incomplete because themes and regular plugins may not be loaded, so flushing now would persist rules that are missing third-party post types, taxonomies, and the product archive. Queue the flush instead and let the next normal request regenerate the rules from a complete graph.
Метод класса: WC_Post_Types{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = WC_Post_Types::flush_rewrite_rules();
Код WC_Post_Types::flush_rewrite_rules() WC Post Types::flush rewrite rules WC 11.2.2
public static function flush_rewrite_rules() {
if ( wp_installing() ) {
update_option( 'woocommerce_queue_flush_rewrite_rules', 'yes' );
/*
* While WordPress is installing, update_option() writes the row but skips every cache
* update, so a persistent object cache keeps serving the previous value and the next
* request never sees the queued flush. Evict both places the option can be cached: on
* its own key, and inside the autoloaded bundle.
*/
wp_cache_delete( 'woocommerce_queue_flush_rewrite_rules', 'options' );
wp_cache_delete( 'alloptions', 'options' );
return;
}
flush_rewrite_rules();
}