Support

Account

Home Forums Backend Issues (wp-admin) Read content of uploaded PDF file and save it ACF field Reply To: Read content of uploaded PDF file and save it ACF field

  • change

    
    $document_file = get_field('document_file', $post_id);
    

    to

    
    $document_file = get_attachment_file(get_field('document_file', $post_id, false));
    

    setting the last parameter false for ACF gets the unformatted value, in this case the attachment ID. The WP function get_attachment_file() loads that file into the variable. Then you can pass this to convert it to text.

    Then you call update_field() to update the text field with what is returned.