Posts: add pre-fetch hook to allow plugins to hang filters on (#487)

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
This commit is contained in:
Brandon Kraft 2023-10-05 08:14:32 +02:00 committed by GitHub
parent e05176cea5
commit b956f5b088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -452,6 +452,15 @@ class Post {
protected function get_content() {
global $post;
/**
* Provides an action hook so plugins can add their own hooks/filters before AP content is generated.
*
* Example: if a plugin adds a filter to `the_content` to add a button to the end of posts, it can also remove that filter here.
*
* @param WP_Post $post The post object.
*/
do_action( 'activitypub_before_get_content', $post );
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$post = $this->wp_post;
$content = $this->get_post_content_template();