我想切換此選項。當選項爲true
時,我想將其更新爲false
。如何切換此選項PHP
update_option('maintenance', true);
我已經試過如下:
if(get_option('maintenance') == true) {
update_option('maintenance', false);
}
if(get_option('maintenance') == false) {
update_option('maintenance', true);
}
但出於某種原因,這並不工作,並且是過於複雜。我相信有更好的方法來做到這一點。
有沒有人有建議?
'update_option()'的內容是什麼? –
@PedroLobito當'true'時,它將返回1.如果爲false,則不返回任何內容。 – Mitch