Skip to content

wpce_before_document_from_post v3.20

Filters the post when a Document is loaded via Document::from_post.

Parameters

  1. ?WP_Post $post

    The post to load the document for. May be null to indicate that the post should be detected from the environment (e.g. the loop's current post or a $_GET['post'] parameter).

  2. bool $preview

    Whether the document is being loaded as a preview.

Example

php
add_filter('wpce_before_document_from_post', function (?WP_Post $post, bool $preview) {
	// ...

	return $post;
}, 10, 2);