Debugging and Problem Solving

The NextGEN Facebook (NGFB) plugin follows the latest recommended WordPress coding practices, but on occasion, it may break other themes and/or plugins that do not.

WordPress Content Filters

WordPress allows plugins and themes to hook into various filters, which are then used by WordPress to expand shortcodes, etc. WordPress generally calls a filter (like ‘the_content’) once to expand text for a given post within the loop or a single webpage. As a consequence, some authors mistakenly assume that a filter they have created will only be executed once for a given post, and only within the webpage body or specific section. WordPress filters are available to any theme and/or plugin that needs to expand text (title, excerpt, content, etc.), and in any context (header, loop, widget, admin, etc.). NGFB uses ‘the_content’ filter to provide a complete and accurate description meta tags (as one example).

On the NGFB Advanced settings page, you can uncheck the ‘Apply Content Filters’ and ‘Apply Excerpt Filters’ to see if your problem is related to a WordPress filter hook. If unchecking these options fixes your problem, you should determine which plugin/theme is at fault and report the issue with the plugin/theme author. Using the WordPress apply_filters() function more than once, in a variety of contexts, should not break a theme and/or plugin.

If you disable the content filter, and your Post/Page content relies upon shortcodes for its text, then you may find that NGFB cannot create accurate description meta tags (or any description text at all). NGFB looks for a custom description and excerpt before falling back to using the content text. In the case where content filters are disabled, and the content uses shortcodes for its text, then you may have to enter an excerpt and/or custom description for those Posts/Pages.

Since NGFB uses the custom description and/or excerpt first, before falling back the content, using a custom description and/or excerpt for a few Posts/Pages could be another alternative to disabling the content filter for the whole website.

Debug and Error Messages

Debug the Front-End

Turning on the WordPress debug log can be highly illuminating — your theme and plugins may be generating many errors, which you would never see unless you turn on the WordPress debug log. To enable the WordPress debug log, without displaying the errors to your visitors, add the following to your wp-config.php file. Make sure you do not already have a define() for WP_DEBUG in your wp-config.php file (constants can only be defined once). If you do, you can safely remove it and replace it with the following lines.

The debug messages will be saved in a wordpress/wp-content/debug.log file. Make sure you clear the contents / rotate this file regularly, as it might grow large enough to fill a filesystem if you use badly coded and/or old plugins and themes.

You can turn on/off the WordPress debug log by changing WP_DEBUG‘s value from true to false.

NGFB can also generate debug / activity messages by ckecking the ‘Add Hidden Debug Info’ on the NGFB Advanced settings page. The debug messages will be added directly to the webpage as HTML comments, to allow debugging issues (on the front-end) remotely. You can also define the following constant to enable the same behavior.

If you would like to send NGFB debug messages to the WordPress log file instead (or as well), you can define the following constant.

Debug the Back-End

To debug an issue in the admin interface, you will have to enable the WordPress debug mode and the NGFB_WP_DEBUG constant as well.

If you have an issue with NGFB in the admin interface, you may be asked to provide a section of the debug.log to help diagnose the issue.

6 thoughts on “Debugging and Problem Solving

  1. Hello there.

    I can’t get the NextGEN Facebook plugin to work together with the NextGEN Gallery shortcode [singlepic], or rather I can’t get the singlepic to show while having NGFB attaching buttons to the contents of a post.
    Some single times I get the singlepic to show, but mostly instead of the picture only the shortcode shows.
    Not sure if this is a common issue or if there’s something else with my service provider that mess this up.
    At the moment I have NGFB disabled since I need to see the photos while working on finishing the webpage.

    Any suggestions?

    Best regards
    Michael

      • I’m using Version 2.0.66.27 of NGG.
        I just updated the NGFB to Version 7.6.4 and now the singlepic glitch doesn’t appear as often as before. I’ve also moved the shortcode from the start of the post so there is text before the shortcode.
        This is an url to one post http://bit.ly/1pnmTfM
        There’s more posts in the menu to the right. All posts have images (from singlepic shortcode), and the glitch appears randomly.

        • I don’t think this is an issue with NGFB — more than likely something is going on with NGG. As you know, NGG v2.x is not without its problems. ;-)

          I’ll try and setup some tests here this afternoon and see if I can’t replicate the issue. Have you tried enabling the debug.log as mentioned in this article? If an error is logged when the problem happens, it would be an excellent clue as to where the problem stems from. ;-)

          Thanks,

          js.

          • I think I managed to find a work around for my problem. By adding the first singlepic-image from NGG as featured image all images have been loading as they should. Since I’ve opted out the featured image viewing from the post itself I just need to remember to add it while adding the singlepic :)

            • Have you tried disabling the content filter (as suggested on this page)? By choosing a featured image, NGFB will select that image and not check the content for its image (and thus apply the content filter). So the content filter could simply be triggering a bug in NextGEN Gallery (or another plugin).

              js.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>