hellofromTonya 2a8a9110d7 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].

Reviewed by jorbin.
Merges [58396] to the 6.5 branch.

Props costdev, rajinsharwar, hellofromTonya.
Fixes #61400.
Built from https://develop.svn.wordpress.org/branches/6.5@58445


git-svn-id: http://core.svn.wordpress.org/branches/6.5@57894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-20 15:30:11 +00:00
..
2024-06-05 15:13:19 +00:00