[wp-trac] [WordPress Trac] #61400: `wp_get_plugin_action_button()` can return `void`.
WordPress Trac
noreply at wordpress.org
Wed Jun 12 18:15:48 UTC 2024
#61400: `wp_get_plugin_action_button()` can return `void`.
---------------------------------------------+-----------------------------
Reporter: costdev | Owner: hellofromTonya
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.6
Component: Plugins | Version: 6.5
Severity: normal | Resolution: fixed
Keywords: has-patch has-unit-tests commit | Focuses:
---------------------------------------------+-----------------------------
Changes (by hellofromTonya):
* status: reviewing => closed
* resolution: => fixed
Comment:
In [changeset:"58396" 58396]:
{{{
#!CommitTicketReference repository="" revision="58396"
Plugins: Ensure wp_get_plugin_action_button() returns a string.
[57545] introduced `wp_get_plugin_action_button()`. This function is
documented to return a `string`. However, if the user does not have the
appropriate capabilities, it returned `void`, which is unexpected.
Resolves the issue by moving the `return $button` to the bottom of the
function to ensure it always returns a `string` type. On success, the
button's HTML string is returned; else, an empty string is returned.
Unit tests are included.
Follow-up to [57545].
Props costdev, rajinsharwar, hellofromTonya.
Fixes #61400.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61400#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list