EnesCanturk adlı üyeden alıntı: mesajı görüntüle
Selamlar

Bir panelim var. Bu panelde de bir switcher var. Aktif olduğu zaman ilgili fonksiyonu çalıştırmak istiyorum. Aktif olmadığı zaman fonksiyon çalışmayacak. Nasıl yapabilirim?

Fonksiyonum:

function disable_gutenberg_editor(
return false;
}
add_filter("use_block_editor_for_post_type", "disable_gutenberg_editor");
Ben şöyle bir şey yaptım ama Undefined variable: activeClassicEditorCheck hatası verdi.

$activeClassicEditorCheck = $fon_panel['activeClassicEditor'];
function disable_gutenberg_editor(){
if( $activeClassicEditorCheck == 1):
return false;
endif;
}
add_filter("use_block_editor_for_post_type", "disable_gutenberg_editor");
Kontrolü fonksiyonun dışında yaptım, çalıştı.


Örnek kod:
if($fon_panel['activeClassicEditor'] == 1){ 
function disable_gutenberg_editor(){
return false;
} 
add_filter("use_block_editor_for_post_type", "disable_gutenberg_editor"); 
}