Sì.
La cosa strana è che dovrebbe essere memorizzato nella cache e non ho motivo di credere che non lo sia.
$categories = get_transient( 'wpdc_discourse_categories' );
if ( ! empty( $options['publish-category-update'] ) || ! $categories ) {
$body = $this->discourse_request( '/site.json' );
if ( is_wp_error( $body ) ) {
return $body;
}
if ( $body->categories ) {
// rimosso per brevità
// Nota che impostare la cache a 0 disabiliterà la scadenza del transient.
$category_cache_period = apply_filters( 'wpdc_category_cache_minutes', 10 );
set_transient( 'wpdc_discourse_categories', $discourse_categories, intval( $category_cache_period ) * MINUTE_IN_SECONDS );
return $discourse_categories;
} else {
return new \WP_Error( 'key_not_found', 'La chiave delle categorie non è stata trovata nella risposta di Discourse.' );
}
}
EDIT Quando elenco i transient ho una chiave timeout_wpdc_discourse_categories con un valore di timestamp tra 5 minuti, ma non ho wpdc_discourse_categories ![]()
EDIT 2 set_transient( 'wpdc_discourse_categories', $discourse_categories, intval( $category_cache_period ) * MINUTE_IN_SECONDS ); sta restituendo false. $discourse_categories è correttamente riempito. Altri transient funzionano.