Skip to content

fix: format wording of plugin update notice#1794

Open
sapayth wants to merge 1 commit intoweDevsOfficial:developfrom
sapayth:fix/format_wording_of_plugin_update_notice
Open

fix: format wording of plugin update notice#1794
sapayth wants to merge 1 commit intoweDevsOfficial:developfrom
sapayth:fix/format_wording_of_plugin_update_notice

Conversation

@sapayth
Copy link
Member

@sapayth sapayth commented Jan 15, 2026

fix #1785

This line appears to be incorrectly formatted:

echo sprintf( wp_kses_post( __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>WP User Frontend Pro</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ), '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">', '</a>' ) );

The line isn’t formatted correctly. The wp_kses_post() function only accepts one parameter, so the additional arguments passed to sprintf() are ignored. As a result, the string isn’t being processed as intended.

Summary by CodeRabbit

  • Bug Fixes
    • Updated upgrade notice message formatting to improve link placement and readability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

Walkthrough

The change corrects improper argument passing to wp_kses_post() in the wpuf_upgrade_notice function by restructuring the message construction. Previously, sprintf arguments were passed outside the translation string, causing them to be ignored by the single-parameter wp_kses_post() function. The fix uses explicit placeholders within the translated string itself.

Changes

Cohort / File(s) Summary
Upgrade Notice Fix
wpuf.php
Restructured wpuf_upgrade_notice message construction to use placeholder syntax (%1$s, %2$s) within the translation string instead of wrapping sprintf arguments outside. Fixes improper parameter passing to wp_kses_post().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • #1478 — Modifies the same wpuf_upgrade_notice function in wpuf.php for text/HTML and translation construction changes.

Suggested labels

bug

Poem

🐰 A rabbit hops through code so tight,
Placeholder syntax set just right!
Arguments flow where they belong,
wp_kses_post sings a happy song! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically refers to formatting the wording of a plugin update notice, which matches the primary change in the PR.
Linked Issues check ✅ Passed The PR addresses issue #1785 by correcting wp_kses_post() usage with sprintf arguments, properly formatting the update notice message as required.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the incorrectly formatted wp_kses_post() call in the wpuf.php update notice, with no unrelated modifications present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@wpuf.php`:
- Around line 263-269: Remove the trailing whitespace on the sprintf block lines
and add a translators comment immediately above the __() call to explain the two
HTML placeholder arguments (e.g., // translators: %1$s opening anchor tag for
free/pro link, %2$s closing anchor tag), and update the anchor href used in the
sprintf placeholders so the anchor wrapping "WP User Frontend Pro" points to the
Pro product URL instead of the free plugin URL; keep the current call structure
using sprintf(...) passed into wp_kses_post(...) and ensure no extra spaces
remain.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 241ef13 and 2d2f9b4.

📒 Files selected for processing (1)
  • wpuf.php
🧰 Additional context used
🪛 GitHub Actions: Inspections
wpuf.php

[warning] 1-1: PHPCS: This comment is 43% valid code; is this commented out code?


[error] 1-1: PHPCS: Whitespace found at end of line.

🪛 GitHub Check: Run PHPCS inspection
wpuf.php

[failure] 265-265:
A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.


[failure] 264-264:
Whitespace found at end of line


[failure] 263-263:
Whitespace found at end of line

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +263 to +269
echo wp_kses_post(
sprintf(
__( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
'<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">',
'</a>'
)
);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Core fix is correct — sprintf() now properly wraps the translation.

The restructuring correctly ensures sprintf() processes the placeholders before the result is passed to wp_kses_post(). This resolves the original issue.

However, there are a few items to address:

  1. Trailing whitespace (lines 263-264): PHPCS is failing due to trailing whitespace.

  2. Missing translators comment: WordPress coding standards require a // translators: comment above __() calls containing placeholders to help translators understand their meaning.

  3. Link URL mismatch: The anchor wraps "WP User Frontend Pro" but links to wordpress.org/plugins/wp-user-frontend/ which is the free plugin page. Should this link to the Pro product page (e.g., wedevs.com/wp-user-frontend-pro/) instead?

Proposed fix addressing whitespace and translators comment
 <?php
-                    echo wp_kses_post( 
-                        sprintf( 
-                            __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
-                            '<a target="_blank" href="https://wordpress.org/plugins/wp-user-frontend/">',
+                    // translators: %1$s and %2$s are opening and closing anchor tags for the WP User Frontend Pro link.
+                    echo wp_kses_post(
+                        sprintf(
+                            __( 'We\'ve pushed a major update on both <b>WP User Frontend Free</b> and <b>%1$sWP User Frontend Pro%2$s</b> that requires you to use latest version of both. Please update the WPUF pro to the latest version. <br><strong>Please make sure to take a complete backup of your site before updating.</strong>', 'wp-user-frontend' ),
+                            '<a target="_blank" href="https://wedevs.com/wp-user-frontend-pro/">',
                             '</a>'
                         )
                     );
🧰 Tools
🪛 GitHub Check: Run PHPCS inspection

[failure] 265-265:
A function call to __() with texts containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.


[failure] 264-264:
Whitespace found at end of line


[failure] 263-263:
Whitespace found at end of line

🤖 Prompt for AI Agents
In `@wpuf.php` around lines 263 - 269, Remove the trailing whitespace on the
sprintf block lines and add a translators comment immediately above the __()
call to explain the two HTML placeholder arguments (e.g., // translators: %1$s
opening anchor tag for free/pro link, %2$s closing anchor tag), and update the
anchor href used in the sprintf placeholders so the anchor wrapping "WP User
Frontend Pro" points to the Pro product URL instead of the free plugin URL; keep
the current call structure using sprintf(...) passed into wp_kses_post(...) and
ensure no extra spaces remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

This line appears to be incorrectly formatted

2 participants