This plugin makes use of many filters to tailor the delivered processing according to a site’s needs.
Most of them are named with a leading ‘document-‘ but there are a few additional non-standard ones shown at the bottom.
In: class-wp-document-revisions.php
Filters the default workflow state values.
In: trait-wp-document-revisions-revisions.php
Filter to allow revision deletion. Set to true to bypass these tests and allow delete. Note that this should be used when deleting revisions by trusted plugins e.g. PublishPress Revisions.
In: class-wp-document-revisions-front-end.php
Filters the Document taxonomies (allowing users to select the first three for the block widget.
In: trait-wp-document-revisions-file-handler.php
Filter to define file writing buffer size (Default 0 = No buffering).
In: class-wp-document-revisions.php
Filters the default capabilities provided by the plugin. Note that by default all custom roles will have the default Subscriber access.
In: class-wp-document-revisionsvalidate-structure.php
Filter to Switch off checking for orphan documents.
In: trait-wp-document-revisions-file-handler.php
Sets the content disposition header to open the document (inline) or to save it (attachment). Ordinarily set as inline but can be changed.
In: trait-wp-document-revisions-file-handler.php
Sets to false to use the standard RSS feed.
In: trait-wp-document-revisions-file-handler.php
Allows the document file extension to be manipulated.
In: trait-wp-document-revisions-admin-editor.php
Filters the default help text for current screen.
In: trait-wp-document-revisions-rewrites.php
Filters the home_url() for WPML and translated documents.
In: trait-wp-document-revisions-file-handler.php
Filters the encoded file name for the attached document (on save).
In: trait-wp-document-revisions-revisions.php
Filters the user locking the document file.
In: trait-wp-document-revisions-revisions.php
Filters the lost lock document email text.
In: trait-wp-document-revisions-file-handler.php
Filters the http response code when a document or revision (attachment) is not found.
[!WARNING]
Modifying the response code from the default value of 403 may introduce an existence vulnerability.By comparing 403 responses (revision found but not authorized) to 404 responses (revision not found) a non-authorized user can determine if a document exists or not.
In: trait-wp-document-revisions-file-handler.php
Filter to serve file even if output already written.
In: trait-wp-document-revisions-file-handler.php, class-wp-document-revisions-validate-structure.php
Filters the file name for WAMP settings (filter routine provided by plugin).
In: trait-wp-document-revisions-rewrites.php
Filters the Document permalink.
In: trait-wp-document-revisions-query.php
Filters the post-thumbnail size parameters (used only if this image size has not been set).
In: class-wp-document-revisions.php, class-wp-document-revisions-front-end.php, class-wp-document-revisions-manage-rest.php, trait-wp-document-revisions-file-handler.php
Filters the users capacities to require read (default) (or read_document) capability to read a document.
In: trait-wp-document-revisions-revisions.php
Filters the plugin query to fetch all the attachments of a parent post.
In: class-wp-document-revisions.php
Filters the delivered document type definition prior to registering it.
In: class-wp-document-revisions.php
Filters the default structure and label values of the workflow_state taxonomy on declaration.
In: trait-wp-document-revisions-query.php
Filters the number of revisions to keep for documents.
In: trait-wp-document-revisions-admin-editor.php
Filters whether to merge two revisions for a change in excerpt (generally where taxonomy change made late).
In: trait-wp-document-revisions-file-handler.php
Filters the MIME type for a file before it is processed by WP Document Revisions.
In: trait-wp-document-revisions-file-handler.php
Filters the HTTP headers sent when a file is served through WP Document Revisions.
In: class-wp-document-revisions.php
Filter to switch off integration with Edit_Flow/PublishPress statuses.
In: trait-wp-document-revisions-rewrites.php
Filters the Document rewrite rules.
In: trait-wp-document-revisions-file-handler.php
Filters file name of document served. (Useful if file is encrypted at rest).
In: trait-wp-document-revisions-file-handler.php
Filter the attachment post to serve (Return false to stop display).
In: trait-wp-document-revisions-file-handler.php
Filter to determine if gzip should be used to serve file (subject to browser negotiation).
In: class-wp-document-revisions-front-end.php
Filters the Document shortcode attributes.
In: class-wp-document-revisions-front-end.php
Filters the controlling option to display an edit option against each document.
⚠️ Experimental — This feature is under active development and may change in future releases.
In: class-wp-document-revisions.php
Filters the show_in_rest parameter from its default value of false. Must be set to true to enable the block editor or REST API access for documents. Enabling this exposes document data via the WordPress REST API using document permissions. See Block Editor Support.
In: trait-wp-document-revisions-file-handler.php
Filters the document slug.
In: class-wp-document-revisions.php, trait-wp-document-revisions-rewrites.php
Filter to stop direct file access to documents (specify the URL element (or trailing part) to traverse to the document directory.
In: trait-wp-document-revisions-query.php
Filter to select which taxonomies with default term count to be modified to count all non-trashed posts.
In: class-wp-document-revisions-front-end.php, class-wp-document-revisions-recently-revised-widget.php
Filters the post thumbnail size on blocks/shortcodes - default thumbnail.
In: trait-wp-document-revisions-query.php
Filter the document title from the post.
In: trait-wp-document-revisions-admin-editor.php
Filters setting the new document status to private.
In: class-wp-document-revisions.php, class-wp-document-revisions-manage-rest.php, trait-wp-document-revisions-admin-editor.php
Filters whether to enable experimental block editor (Gutenberg) support for documents. Default is false. When set to true, enables REST API write methods, registers post meta for REST, adds excerpt support to the document post type, and hides the main editor canvas. Must be used together with document_show_in_rest filter. See Block Editor Support.
In: class-wp-document-revisions.php
Filter to switch off use of standard Workflow States taxonomy. For internal use.
In: trait-wp-document-revisions-file-handler.php
Filter whether WP_FileSystem used to serve document (or PHP readfile). Irrelevant if file compressed on output.
In: class-wp-document-revisions-validate-structure.php
Filter whether to validate the document structure for a documrnt.
In: class-wp-document-revisions-validate-structure.php
Filter to switch off md5 format attachment validation.
In: class-wp-document-revisions-validate-structure.php
Filters the list of orphan attachment records found for a document.
In: trait-wp-document-revisions-file-handler.php
Allows the RSS feed to be switched off.
In: trait-wp-document-revisions-revisions.php
Filters the locked document email subject text.
In: trait-wp-document-revisions-revisions.php
Filters the locked document email message text.
In: trait-wp-document-revisions-revisions.php
Filters the option to send a locked document override email
In: trait-wp-document-revisions-file-handler.php
Filters the decision to serve the document through WP Document Revisions.
In: includes/class-wp-document-revisions-text-extractor-registry.php
Ordered list of WP_Document_Revisions_Text_Extractor implementations. The first whose supports($mime_type) returns true wins. Prepend with array_unshift() to override the built-in PDF and DOCX extractors; append to add support for additional file formats. See the Text Extraction & AI Summaries cookbook entry for an example.
In: includes/class-wp-document-revisions-text-extractor-scheduler.php
Seconds between a revision attachment insert and the cron event that runs extraction. Default 10. Raise on sites where post-save listeners are slow.
In: includes/class-wp-document-revisions-text-extractor-scheduler.php
Hard timeout, in seconds, applied via set_time_limit() inside the extraction cron handler. Default 30. Advisory only — no-op when safe_mode is on or set_time_limit is disabled.
In: includes/class-wp-document-revisions-text-diff.php
Lines of context per hunk emitted by the unified-diff helper when summarising a revision. Default 3. Set higher to give the AI more surrounding context for references like “Section 4.2.”
In: includes/class-wp-document-revisions-text-diff.php
Maximum rendered-diff size, in characters, before the helper reports too_large and the summary path falls back to summarising the new document directly. Default 50000.
In: includes/class-wp-document-revisions-ai-summary.php
Force-enable (return true) or force-disable (return false) the AI summary generation pipeline. The default check is function_exists( 'wp_ai_client_prompt' ) (WordPress 7.0+) combined with the WP_AI_SUPPORT constant. Tests and sites running an alternative provider via wpdr_ai_summary_generator use this to force-enable without WP 7.0.
In: includes/class-wp-document-revisions-ai-summary.php
Intercept the AI call. Receives (string|null $default, string $prompt); return a string to short-circuit the WP AI Client invocation (used by the test suite and by sites running an alternative SDK), or null to defer to the default wp_ai_client_prompt() path.
In: includes/class-wp-document-revisions-ai-summary.php
Customize the system prompt template. Receives (string $default, string $kind, int $attachment_id) where $kind is one of 'change' or 'document'. Return a string to replace the template. The input text (diff or extracted text) is deliberately NOT passed — it is concatenated after the template, not substituted into it. See the cookbook recipe for an example.
In: includes/class-wp-document-revisions-ai-summary.php
Seconds between text extraction completing and the summary cron event firing. Default 10. Mirrors wpdr_text_extraction_delay for the second stage of the pipeline.
In: includes/class-wp-document-revisions-ai-summary.php
Hard timeout, in seconds, for a single summary generation call. Default 60. Applied via set_time_limit() inside the cron handler (advisory).