Small error in code
-
After installing plugin, it throws error(if DEBUG enabled):
Notice: Undefined index: post_type in /.../public_html/wp-content/plugins/woo-orders-date-range-filter/woo-orders-date-range-filter.php on line 169
This problem occurs on pages that doesn’t have GET[‘post_type’] in url, because code tries to compare(AND) with undefined($post_type) value:
$post_type = sanitize_text_field($_GET['post_type']); if (!isset($_GET['post_type']) && $post_type !='shop_order') { return false; }
I have changed compare type to OR and problem solved when there’s no $post_type at all:
$post_type = sanitize_text_field($_GET['post_type']); if (!isset($_GET['post_type']) || $post_type !='shop_order') { //changed from && to return false; }
Reply me if I’m not right ?? and of course thanks for great plugin!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Small error in code’ is closed to new replies.