Support » Fixing WordPress » Debugging WordPress problems – Strategies?

  • Hi
    I am really struggling to find useful, live debugging aids for wordpress for a number of issues. The usual advice whenever I hit a problem and google for solutions is “change the theme and switch off all the plugins”. This is completely impractical on live, production sites as I need to keep them going while figuring out usually minor glitches – I am also nervous about doing it anyway, since i run the risk of losing custom plugin data and never getting the site back to looking and working the way it originally did.

    I would like to know if anyone has found usable tools to assist in live debugging. I have tried using WP_DEBUG to logfiles and thanks to the innate volubility of this have found it pretty useless – filling up with NOTICEs in seconds – there seems no way to restrict what gets added to WP_DEBUG logs (unlike php logs in general).

    Currently I have two problems I am completely stuck with – inability for Contact Form 7 to send emails from a form on one site (here I am using multisite and another site on same install sends contact forms just fine), and a problem with notification emails for new users (activation email is sent but no second email) see here: https://wordpress.org/support/topic/new-user-activation-email-seny-ok-but-no-password-login-email?replies=11

    Thanks for looking…

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hate to say it but have you thought about creating a staging version of each site to do debugging on if effects to production are not acceptable its generally good practise to do this.

    For the contact forms have you tried contact form DB? It stores a copy of the form response. This first step will let you know if the form is submitting properly and allow you to debug if its another setting / SMTP issue.

    Thanks – I will try the contact form DB plugin…
    I do have a copy of some of the sites set up on my local server for debugging purposes, but it takes so long to get them synced and working the same and then half the time the problem doesn’t occur the same on both. Bloody pain in the ass…
    Surely someone out there must have come up with something – I’ll be prepared to pay good money for a decent debugging environment/reporting tool… without it I am starting to think of switching platforms and dumping my current clients coz this is a hiding to nothing – I seem to spend hours and hours a week going round in circles banging my head against a wall trying to fix problems that have sneaked in since the last round of upgrades…

    It can be tricky with debugging because like any open source platform WordPress is extended by a series of 3rd party plugins which are for the most part independent of each other.

    Unsure of your php knowledge but we take the approach of this for plugins:
    – Can we code what we need to do using WP and its core functions easily? yes ok dont look for a plugin do it
    – Is it massive and we don’t have time, ok look for a plugin but ensure its been updated a lot and used by a significant number of users
    – Ensure we have the auto updates in place for both WP and plugins in the functions file.

    WP is great with plugins and themes but experience has taught me you should try to have as few plugins as you can.

    For most sites all I ever use is literally:
    acf-repeater
    advanced-custom-fields
    contact-form-7
    contact-form-7-to-database-extension
    bulk-resize-media
    tinymce-advanced
    resize-image-after-upload
    redirection
    wordfence
    broken-link-checker
    better-search-replace
    wordpress-seo

    using a custom theme built from scratch with functions etc built over time

    I guess you’re right. Unfortunately I have acquired over the years a range of third-party developed wordpress sites that I now have to maintain. I have untangled the worst of the problems – like direct modification of theme (and plugin) files rather than using child themes, but these clients generally can not afford for me to do a complete redesign.
    In the old days it was simple – if a client wanted something I just had to write it myself, so it was relatively easy to find out where it was broken. Nowadays people are not prepared to pay me to do that in the main and instead I am left trying to figure out what is wrong with other people’s code 🙁

    Oh yea i know that pain, had a few woo themed sites that were a mess!

    Tend to use the old mantra of ‘its gonna cost more to fix than it will do to start again’ tends to work for us :D.

    latro666,

    What’s the advantage of ensuring your plugins are set to auto update?

    It would seem to me the prudent thing to do would be to set aside a time once a month to update plugins, etc so that when something goes ‘bump’, you’ve got time already set aside to deal with it…

    I agree with cantonjester re manual updates – I only recently grudgingly accepted default WordPress autoupdates – I’m much happier manually updating stuff so I can check and see if it breaks…
    Trouble is I’m finding it more and more difficult to keep up!

    It might be useful for others to know the way I came up with to pin down what plugin is causing problems without doing the whole ‘switch off all plugins and slowly switch them back on one-by-one’ thing, which is usually completely impractical (especially on a live site)… This was in relation to the email notification problem I have been having on one site…

    You do have to have access to the command line to do this though.

    0) Figure out EXACTLY what the problem is – harder than it sounds and involves lots of experimentation – in my case people were trying to sign up to a bb-press forum and though getting their activation emails they were not getting username and password emails. It was only when I was reduced to setting up their accounts manually, I realised that in fact a more general problem was that though user email notification was on, my test user emails were not getting their new user email notification – now I know what the underlying issue is and what to search for…

    1) Ascertain the likely function that is having problems – in this case I searched through the WordPress function reference here: https://codex.wordpress.org/Function_Reference for ‘notification’ and found the likely “wp_new_user_notification” function…

    2) search the plugins directory for any occurrence of this text string to find out which plugins might be messing with it… I navigated to the plugins directory (/<web-root>/wp-content/plugins) and typed:
    # find . -type f -exec grep -i ‘wp_new_user_notification’ {} +
    …which listed all the occurrences of that string.
    In this case they were: cimy-user-extra-fields and login-with-ajax
    I tried deactivating each of these in turn and found that the emails started going out again when I deactivated the cimy user extra fields plugin.

    3) Post a question on the plugin forum explaining what happens (don’t forget to mention wordpress and plugin version) and hope that someone who knows the plugin well will come up with a solution or workaround or that the developer will fix the bug!

    Meantime I can either leave the plugin deactivated so that new users can sign up or figure out a way to get this plugin working appropriately as it is important to the function of my site!

    Hope this is useful to someone else…
    theWoosh

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Debugging WordPress problems – Strategies?’ is closed to new replies.