Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend scripts: print options later #1131

Merged
merged 6 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Undefined array key warnings in various places
* 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
Expand Down
4 changes: 2 additions & 2 deletions includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -119,7 +119,7 @@ public static function inject_activitypub_options() {
);

printf(
'<script>var _activityPubOptions = %s;</script>',
"\n<script>var _activityPubOptions = %s;</script>",
wp_json_encode( $data )
);
}
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ For reasons of data protection, it is not possible to see the followers of other
* Changed: Hide ActivityPub post meta keys from the custom Fields UI
* Fixed: Undefined array key warnings in various places
* 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 =

Expand Down
Loading