Skip to content

Inline the custom JavaScript using wp_print_inline_script_tag() #12

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

Merged
merged 1 commit into from
Aug 11, 2025

Conversation

soderlind
Copy link
Owner

This pull request updates the plugin to version 1.1.6 and addresses how custom JavaScript is added to WordPress sites. The main improvements are switching to the recommended WordPress function for inlining JavaScript and moving the script output from the page header to the footer for better performance and compatibility.

JavaScript Output Improvements:

  • Changed the method for inlining custom JavaScript to use wp_print_inline_script_tag(), which is the WordPress-recommended approach for adding inline scripts.
  • Moved the output of the custom JavaScript from the <head> (using wp_head) to the footer (using wp_footer), ensuring scripts are loaded at the optimal time.

Version and Documentation Updates:

  • Bumped the plugin version to 1.1.6 in additional-javascript.php, package.json, and updated the stable tag in readme.txt. [1] [2] [3]
  • Updated the changelog in both CHANGELOG.md and readme.txt to document these changes. [1] [2]

- Updated version number in additional-javascript.php, package.json, and package-lock.json to 1.1.6.
- Modified readme.txt to reflect the new stable tag of 1.1.6.
- Added changelog entries for version 1.1.6:
  - Inline the custom JavaScript using `wp_print_inline_script_tag()`.
  - Ensure the script is printed in the footer.
@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 09:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the Additional JavaScript plugin to version 1.1.6, modernizing how custom JavaScript is output in WordPress sites by adopting WordPress best practices and improving performance.

  • Replaces manual inline script output with the WordPress-recommended wp_print_inline_script_tag() function
  • Moves JavaScript output from page header to footer for better performance
  • Updates version numbers and documentation across all relevant files

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
additional-javascript.php Updated version number, moved script hook from wp_head to wp_footer, and replaced manual script tag generation with wp_print_inline_script_tag()
package.json Bumped version from 1.1.5 to 1.1.6
readme.txt Updated stable tag and added changelog entry for version 1.1.6
CHANGELOG.md Added changelog entry documenting the JavaScript output improvements

## [1.1.6] - 2025-08-11

### Fixed
- Inline the custom javascript using ` ()`
Copy link
Preview

Copilot AI Aug 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name appears to be incomplete or corrupted. It should be wp_print_inline_script_tag() instead of just the backticks with a tab character.

Suggested change
- Inline the custom javascript using ` ()`
- Inline the custom javascript using `wp_print_inline_script_tag()`

Copilot uses AI. Check for mistakes.

@soderlind soderlind merged commit 2d76eee into main Aug 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant