Skip to content

Commit 8100153

Browse files
authored
Frontend scripts: print options later (#1131)
* Frontend scripts: print options later * changelog * print frontend scripts in footer * changelog ii
1 parent dfc23ad commit 8100153

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
* Fetching replies from the same instance for Enable Mastodon Apps
2525
* Image captions not being included in the ActivityPub representation when the image is attached to the post
2626

27+
### Changed
28+
* Print `_activityPubOptions` in the `wp_footer` action on the frontend.
29+
2730
## [4.6.0] - 2024-12-20
2831

2932
### Added

includes/class-blocks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function init() {
2121
// This is already being called on the init hook, so just add it.
2222
self::register_blocks();
2323

24-
\add_action( 'wp_enqueue_scripts', array( self::class, 'inject_activitypub_options' ) );
24+
\add_action( 'wp_footer', array( self::class, 'inject_activitypub_options' ) );
2525
\add_action( 'admin_print_scripts', array( self::class, 'inject_activitypub_options' ) );
2626
\add_action( 'load-post-new.php', array( self::class, 'handle_in_reply_to_get_param' ) );
2727
// Add editor plugin.
@@ -119,7 +119,7 @@ public static function inject_activitypub_options() {
119119
);
120120

121121
printf(
122-
'<script>var _activityPubOptions = %s;</script>',
122+
"\n<script>var _activityPubOptions = %s;</script>",
123123
wp_json_encode( $data )
124124
);
125125
}

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ For reasons of data protection, it is not possible to see the followers of other
142142
* Fixed: @-mentions in federated comments being displayed with a line break
143143
* Fixed: Fetching replies from the same instance for Enable Mastodon Apps
144144
* Fixed: Image captions not being included in the ActivityPub representation when the image is attached to the post
145+
* Changed: Print `_activityPubOptions` in the `wp_footer` action on the frontend.
145146

146147
= 4.6.0 =
147148

0 commit comments

Comments
 (0)