| @@ -88,9 +88,9 @@ | ||
| 88 | 88 | // Handle post_types - it comes as JSON string from JavaScript or as array |
| 89 | 89 | $post_types_raw = $_POST['post_types'] ?? '["post"]'; |
| 90 | 90 | |
| 91 | 91 | // Debug: log the type and value of post_types_raw |
| 92 | - error_log('DEBUG: post_types_raw type: ' . gettype($post_types_raw) . ', value: ' . print_r($post_types_raw, true)); | |
| 92 | + // error_log('DEBUG: post_types_raw type: ' . gettype($post_types_raw) . ', value: ' . print_r($post_types_raw, true)); | |
| 93 | 93 | |
| 94 | 94 | // Check if it's already an array (PRO version) or needs decoding (Free version) |
| 95 | 95 | if (is_array($post_types_raw)) { |
| 96 | 96 | $post_types = $this->sanitize_array($post_types_raw); |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | $post_types = $this->sanitize_array($post_types_raw); |
| 97 | 97 | } else { |
| 98 | 98 | // Ensure it's a string before decoding |
| 99 | 99 | if (!is_string($post_types_raw)) { |
| 100 | - error_log('DEBUG: post_types_raw is not a string, converting to: ' . json_encode($post_types_raw)); | |
| 100 | + // error_log('DEBUG: post_types_raw is not a string, converting to: ' . json_encode($post_types_raw)); | |
| 101 | 101 | $post_types_raw = json_encode($post_types_raw); |
| 102 | 102 | } |
| 103 | 103 | $post_types_decoded = json_decode($post_types_raw, true); |
| 104 | 104 | $post_types = is_array($post_types_decoded) ? $this->sanitize_array($post_types_decoded) : ['post']; |
| @@ -142,10 +142,10 @@ | ||
| 142 | 142 | ]; |
| 143 | 143 | |
| 144 | 144 | wp_send_json_success($response_data); |
| 145 | 145 | } catch (Exception $e) { |
| 146 | - error_log('Dynamic Posts Grid Filter AJAX Error: ' . $e->getMessage()); | |
| 147 | - error_log('Stack trace: ' . $e->getTraceAsString()); | |
| 146 | + // error_log('Dynamic Posts Grid Filter AJAX Error: ' . $e->getMessage()); | |
| 147 | + // error_log('Stack trace: ' . $e->getTraceAsString()); | |
| 148 | 148 | wp_send_json_error(['message' => esc_html__('An error occurred while filtering posts.', 'king-addons')]); |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
| @@ -166,9 +166,9 @@ | ||
| 166 | 166 | // Handle post_types - it comes as JSON string from JavaScript or as array |
| 167 | 167 | $post_types_raw = $_POST['post_types'] ?? '["post"]'; |
| 168 | 168 | |
| 169 | 169 | // Debug: log the type and value of post_types_raw |
| 170 | - error_log('DEBUG: post_types_raw type: ' . gettype($post_types_raw) . ', value: ' . print_r($post_types_raw, true)); | |
| 170 | + // error_log('DEBUG: post_types_raw type: ' . gettype($post_types_raw) . ', value: ' . print_r($post_types_raw, true)); | |
| 171 | 171 | |
| 172 | 172 | // Check if it's already an array (PRO version) or needs decoding (Free version) |
| 173 | 173 | if (is_array($post_types_raw)) { |
| 174 | 174 | $post_types = $this->sanitize_array($post_types_raw); |
| @@ -174,9 +174,9 @@ | ||
| 174 | 174 | $post_types = $this->sanitize_array($post_types_raw); |
| 175 | 175 | } else { |
| 176 | 176 | // Ensure it's a string before decoding |
| 177 | 177 | if (!is_string($post_types_raw)) { |
| 178 | - error_log('DEBUG: post_types_raw is not a string, converting to: ' . json_encode($post_types_raw)); | |
| 178 | + // error_log('DEBUG: post_types_raw is not a string, converting to: ' . json_encode($post_types_raw)); | |
| 179 | 179 | $post_types_raw = json_encode($post_types_raw); |
| 180 | 180 | } |
| 181 | 181 | $post_types_decoded = json_decode($post_types_raw, true); |
| 182 | 182 | $post_types = is_array($post_types_decoded) ? $this->sanitize_array($post_types_decoded) : ['post']; |
| @@ -223,10 +223,10 @@ | ||
| 223 | 223 | ]; |
| 224 | 224 | |
| 225 | 225 | wp_send_json_success($response_data); |
| 226 | 226 | } catch (Exception $e) { |
| 227 | - error_log('Dynamic Posts Grid AJAX Error: ' . $e->getMessage()); | |
| 228 | - error_log('Stack trace: ' . $e->getTraceAsString()); | |
| 227 | + // error_log('Dynamic Posts Grid AJAX Error: ' . $e->getMessage()); | |
| 228 | + // error_log('Stack trace: ' . $e->getTraceAsString()); | |
| 229 | 229 | wp_send_json_error(['message' => esc_html__('An error occurred while loading posts.', 'king-addons')]); |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |