PHP 8.x Warnings Admin
-
Hi,
On PHP 8.x, I’m getting these warnings when visiting admin pages that don’t have a $post object (e.g., WCK Post Type Creator, Taxonomy Creator, etc.):
[12-Aug-2025 15:08:13 UTC] PHP Warning: Attempt to read property “post_type” on null in /sites/website/files/wp-content/plugins/custom-permalinks/includes/class-custom-permalinks-form.php on line 91
[12-Aug-2025 15:08:13 UTC] PHP Warning: Attempt to read property “post_type” on null in /sites/website/files/wp-content/plugins/custom-permalinks/includes/class-custom-permalinks-form.php on line 123
[12-Aug-2025 15:08:13 UTC] PHP Warning: Attempt to read property “ID” on null in /sites/website/files/wp-content/plugins/custom-permalinks/includes/class-custom-permalinks-form.php on line 125
[12-Aug-2025 15:08:13 UTC] PHP Warning: Attempt to read property “post_type” on null in /sites/website/files/wp-content/plugins/custom-permalinks/includes/class-custom-permalinks-form.php on line 127
Seems like the global $post is assumed to always be a WP_Post, but on non-post admin screens, it’s null. Simply guarding it would fix these warnings.
Could you include this fix in the next release please?
Best,
The topic ‘PHP 8.x Warnings Admin’ is closed to new replies.