Notice: ‘post_type’ undefined index
-
I just noticed a PHP:NOTICE for this plugin here:
[13-Mar-2020 12:12:07 UTC] PHP Notice: Undefined index: post_type in /var/www/html/wp-content/plugins/update-alt-attribute/incl/media_custom_alt.php on line 150
the $query is assumed to always have a ‘post_type’ defined, wich does not have be the case.
Simply checking the existence of that index first should solve the issue.if ( array_key_exists('post_type', $query->query ) && array_key_exists($query->query['post_type'] == 'attachment') && !empty($query->query['s'])) {
I would be thankful, if that could be added to the plugin,
Happy Coding,
tobidot
- The topic ‘Notice: ‘post_type’ undefined index’ is closed to new replies.