From 81001534a2ce9cd1ea0d16c2e53083194d8b8ea8 Mon Sep 17 00:00:00 2001 From: Matt Wiebe Date: Fri, 10 Jan 2025 16:02:49 -0600 Subject: [PATCH] Frontend scripts: print options later (#1131) * Frontend scripts: print options later * changelog * print frontend scripts in footer * changelog ii --- CHANGELOG.md | 3 +++ includes/class-blocks.php | 4 ++-- readme.txt | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40f85087e..f531e2c27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fetching replies from the same instance for Enable Mastodon Apps * Image captions not being included in the ActivityPub representation when the image is attached to the post +### Changed +* Print `_activityPubOptions` in the `wp_footer` action on the frontend. + ## [4.6.0] - 2024-12-20 ### Added diff --git a/includes/class-blocks.php b/includes/class-blocks.php index 716319ca7..c34cd32ea 100644 --- a/includes/class-blocks.php +++ b/includes/class-blocks.php @@ -21,7 +21,7 @@ public static function init() { // This is already being called on the init hook, so just add it. self::register_blocks(); - \add_action( 'wp_enqueue_scripts', array( self::class, 'inject_activitypub_options' ) ); + \add_action( 'wp_footer', array( self::class, 'inject_activitypub_options' ) ); \add_action( 'admin_print_scripts', array( self::class, 'inject_activitypub_options' ) ); \add_action( 'load-post-new.php', array( self::class, 'handle_in_reply_to_get_param' ) ); // Add editor plugin. @@ -119,7 +119,7 @@ public static function inject_activitypub_options() { ); printf( - '', + "\n", wp_json_encode( $data ) ); } diff --git a/readme.txt b/readme.txt index f16c10315..a1ba78e42 100644 --- a/readme.txt +++ b/readme.txt @@ -142,6 +142,7 @@ For reasons of data protection, it is not possible to see the followers of other * Fixed: @-mentions in federated comments being displayed with a line break * Fixed: Fetching replies from the same instance for Enable Mastodon Apps * Fixed: Image captions not being included in the ActivityPub representation when the image is attached to the post +* Changed: Print `_activityPubOptions` in the `wp_footer` action on the frontend. = 4.6.0 =