хотите обновить расширенное настраиваемое поле при обновлении поста WordPress - PullRequest
0 голосов
/ 06 сентября 2018

Я хочу обновить расширенное настраиваемое поле при обновлении поста WordPress. Я использовал приведенный ниже код для этого, но update_field не работает, любая идея?

function check_values($post_ID, $post_after, $post_before)
{

 //File Unzip 
             WP_Filesystem();
             $destination = wp_upload_dir();
             $destination_path = $destination['path'];
             $unzipfile = unzip_file( $destination_path.'/'XML.zip', $destination_path);
                //Update Advanced Custom Field

              $field_key = "field_599d2d288e37c";
              $value = $destination_path;
              update_field( $field_key, $value, $post_ID );
            }

  add_action( 'post_updated', 'check_values', 10, 3 ); //don't forget the last argument to allow all three arguments of the function
...