Document could not be found fixed
-
Hi – Thought this might help someone. I had a problem recently with get a “Document not found” error when updating a previously working document.
Looking at the entry in the database I noticed that the post_content for the new upload was being saved as
<!-- WPDR $post_id -->
where post_id was just the id of the document, I assume for Gutenberg compatibility.I was able to ‘fix’ the issue by modifying the ‘extract_document_id’ function found at line 2637 of class_wp_document_revisions.php by modifying the grep in the preg_match to include the spaces.
Example:
Before –preg_match( '/<!-- WPDR ([(0-9]+) -->/', $post_content, $id );
After –preg_match( '/<!-- WPDR\s([(0-9]+)\s-->/', $post_content, $id );
Maybe the plugin could be updated to include this change.
Cheers
- The topic ‘Document could not be found fixed’ is closed to new replies.