Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
2 17
Newest
 Critic
Impact
~34k people reached

Apr
14
comment Prevent wp_debug from polluting ajax within plugin
$wpdb->esc_like($title) works, though the headers sent warning returns, and ob_buffer still has noting to delete. - squirlie problem this is. I'll workin your more robust suggestions and hopeful in that process I sort the issue.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
Well spotted! However, this leads to PHP Strict Standards: Non-static method wpdb::esc_like() should not be called statically in . . . . 8{
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
given what Im seeing - I'm going to work in your second approach. I'd like this to be as robust as possible without making demands on the environment. I can see having to move hosts for example in a year, and I'd hate to overcomplicate this, in case its not me who does it. It will take a few days before I can get to this but will come back with comments. Many thanks again for sharing your approach - very helpful indeed.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
Also, regardless of the use or warnings related to ob_clean, I'm still seeing the notices make their way through to the response, so a check won't affect the results. This would seem evidence that ob_clean, isn't actually doing what the codex suggest. joson_encode however does just fine, when wp_debug is disabled. So this leads me to think that the notices are causing the issue, not the construction of json itself. a quandry - I will double check the json results to be sure.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
Thanks for the detailed write up! I will digest, but regarding the headers, I initially had them where you suggested, but received headers already sent warnings. I moved it up to the position until they disappeared.
Apr
14
revised Prevent wp_debug from polluting ajax within plugin
added a quote from the codex.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
There deprecated notices for like_escape which is used in wp-includes/functions.php, so nothing I have control over as Im currently running the latest version of WP. @TheDeadMedic following guidance from codex.wordpress.org/AJAX_in_Plugins, they sugest under the dubuggin section that ob_clean() will clear any notices before sending them through as part of the json output - wreaking havoc. -- I'll up the post with their recommendations.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
@TheDeadMedic your advice is good and I've taken a revision. But the result is the same. @czerspalace with this refactoring the result is the same as your suggestion no? Yes a better block of code, but still: PHP Notice: ob_clean(): failed to delete buffer. No buffer to delete in ....
Apr
14
revised Prevent wp_debug from polluting ajax within plugin
onboarding recommendations but found same results
Apr
14
asked Prevent wp_debug from polluting ajax within plugin
Mar
30
awarded  Popular Question
Mar
20
awarded  Curious
Mar
20
answered How do i add class=“fancybox” to the default gallery?
Mar
18
answered Trigger save as draft when uploaded image
Dec
2
awarded  Revival
Dec
1
awarded  Popular Question
Oct
7
awarded  Popular Question
Aug
17
revised Theme Customizer - Dynamic CSS PHP File
revised statement about location of add_action wp_ajax
Aug
17
revised Using wp_enqueue_script on shortcode function handler
added 4 characters in body
Aug
17
revised tinymce modal and I18n strings methods
deleted 182 characters in body