Skip to content

Commit b608a5f

Browse files
author
Guido W. Pettinari
committed
Fix bug per cui i settings non potevano essere salvati
1 parent 41a159c commit b608a5f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/class-settings-page.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class SettingsPage extends MenuPage
4242
* Settings API di WordPress; verrà impostato nel
4343
* constructor automaticamente
4444
*/
45-
private $api;
45+
public $api;
4646

4747
/**
4848
* Metodo da sovrascrivere che ritorna l'array delle sezioni
@@ -89,13 +89,12 @@ function( $cap ) {
8989
* Callback che registra tutti i nostri settings usando l'API
9090
*/
9191
public function admin_init() {
92-
// Se non siamo sulla pagina dei settings, non
93-
// serve calcolare le sezioni e i campi
94-
if ( ( $_GET[ 'page' ] ?? '' ) !== $this->slug ) {
95-
return;
96-
}
9792
$this->api->set_sections( $this->getSections() );
98-
$this->api->set_fields( $this->getFields() );
93+
// Se non siamo sulla pagina specifica della sezione,
94+
// non serve calcolare tutti i campi
95+
if ( ( $_GET[ 'page' ] ?? '' ) === $this->slug ) {
96+
$this->api->set_fields( $this->getFields() );
97+
}
9998
$this->api->admin_init();
10099
}
101100

0 commit comments

Comments
 (0)