2013-02-05 7 views
0

이 함수를 사용하려면 update_options를 가져 오려고합니다. 기본적으로 사용자는 활성화 코드를 입력하고 플러그인 옵션 페이지를 통해 제출합니다. 코드가 제 3 자에게 보내지고 성공하면 상태가 반환됩니다. 이것은 모두 작동하지만 update_options를 사용하여 문제의 옵션 상태를 변경할 수는 없습니다.Wordpress OOP 프레임 워크가 update_options 함수와 함께 작동하지 않습니다.

private function _admin_options_update() { 
    // Verify submission for processing using wp_nonce 
    if(wp_verify_nonce($_REQUEST['_wpnonce'], "{$this->namespace}-update-options")) { 
     $data = array(); 
     /** 
     * Loop through each POSTed value and sanitize it to protect against malicious code. Please 
     * note that rich text (or full HTML fields) should not be processed by this function and 
     * dealt with directly. 
     */ 
     foreach($_POST['data'] as $key => $val) { 
      $data[$key] = $this->_sanitize($val); 
     } 

     /** 
     * Place your options processing and storage code here 
     */ 

     // Update the options value with the data submitted 
     update_option($this->option_name, $data); 

     // Redirect back to the options page with the message flag to show the saved message 
     wp_safe_redirect($_REQUEST['_wp_http_referer'] . '&update=1'); 
     exit; 
    } 
} 

나는이 기능을 실행하기 위해 노력하고있어 :

update_option ($ WPBackitup-> 옵션 [ '을 여기에

은 (내가 사용 OOP 프레임 워크의 일부) 업데이트 기능입니다 status '], $ license_data-> license);

답변

0

나 자신을 알아 냈습니다. 기본적으로이 프레임 워크는 양식 변수를 통해 제출 된 모든 데이터를 위생 처리 한 다음 DB에 제출합니다. 필자는 프레임 워크가 위생 처리되어 DB로 전송 된 배열로 반환 값을 수동으로로드하여 작업 할 타사 API를 얻었습니다. 일단 내가 그 일을 마치면 update_options()가 매력처럼 작동했습니다!

관련 문제