On the "pulled" list in the PullListTable view (/wp-admin/admin.php?page=pull&status=pulled), the following deprecation notice is thrown (if running php 8.1 or above) for each post in the list if the current user cannot edit that post:
Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /wp-includes/formatting.php on line 4494
Describe the bug
On the "pulled" list in the PullListTable view (
/wp-admin/admin.php?page=pull&status=pulled
), the following deprecation notice is thrown (if running php 8.1 or above) for each post in the list if the current user cannot edit that post:Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated in /wp-includes/formatting.php on line 4494
The issue is that the Edit link is added to the list table (here: https://github.com/10up/distributor/blob/develop/includes/classes/PullListTable.php#L370) without a check for if the current user can edit that post. This results in the call to
get_edit_post_link
returningnull
and passing that toesc_url
triggers the deprecation notice above.On our setup we don't allow the pulled posts to be edited so we have a filter kind of like this to make sure they're not:
The easiest fix for this is probably to change these lines https://github.com/10up/distributor/blob/develop/includes/classes/PullListTable.php#L368-L373 to something like:
Happy to make a PR if y'all deem it worthwhile. :)
Steps to Reproduce
map_meta_cap
so that the current user is not allowed to edit distributed posts.WP_DEBUG
set totrue
Screenshots, screen recording, code snippet
No response
Environment information
No response
WordPress information
No response
Code of Conduct