• Resolved Luis Martins

    (@lmartins)


    Hi,

    Since the latest update New Relic is constantly outputting the following errors for sites where Im using Note:

    Error message
    E_ERROR: Call to undefined function note_widget()
    
    Stack trace
    …wordpress/wordpress/wp-content/plugins/note/includes/
    class-note-customizer.php (126)
    in Note_Customizer::init called at ? (?)
    …call_user_func_array called at /srv/wordpress/wordpress/wp-includes/
    plugin.php (496)
    in do_action called at /srv/wordpress/wordpress/wp-settings.php (353)
    in require_once called at /srv/wordpress/wordpress/wp-config.php (141)
    in require_once called at /srv/wordpress/wordpress/wp-load.php (37)
    in require_once called at /srv/wordpress/wordpress/wp-blog-header.php (12)
    in require called at /srv/wordpress/wordpress/index.php (17)

    https://www.ads-software.com/plugins/note/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Slocum Studio

    (@slocumstudio)

    Hi Luis,

    Thanks for reporting this error. Unfortunately, we’re not able to reproduce this error in our testing.

    Here’s a bit of technical background as to how this particular portion of Note is functioning:

    We have logic that is setup to run in the Customizer to populate a few areas of Note with configuration data. This logic is run on the init action at the normal default priority of 10. Our init logic should always fire after the widgets_init action which introduces the Note_Widget() helper function and registers the Note Widget in WordPress. This is because the widgets_init action is set to run at priority 1 of the init action and since ours is set to the default of 10, it should fire after widgets_init.

    That being said, we are noticing that in your report, this helper function appears to be lowercase: note_widget(). We’re not sure if this is due to New Relic’s error reporting, copying and pasting into WordPress support, or if your version of Note is trying to call a lowercase version of that function.

    You can see here in the Note code base that the function call is correct for where the error is being reported in your instance – https://plugins.trac.www.ads-software.com/browser/note/trunk/includes/class-note-customizer.php#L126. We’ve also ensured that our version control repositories contain the correct function call, and they do.

    I would first suggest re-installing Note to see if this error still persists. If it does, would you be able to provide us with more information about your setup such as PHP version, WordPress version, theme, active plugins, etc..?

    Thank You,
    Scott

    Thread Starter Luis Martins

    (@lmartins)

    Sorry, I didn’t got a notification for your reply and only when noticed it today. Will confirm your suggestions and report back here.

    Thread Starter Luis Martins

    (@lmartins)

    Hello again,

    I’ve noticed that the pages that are triggering this error are always /sitemap_index.xml, which is really weird since they shouldn’t be running code from this widget anyway. I’ve checked the plugin source on my install and it does show the correct word capitalisation, however the log files show the same problem.

    Any tips on what might be happening?

    Thread Starter Luis Martins

    (@lmartins)

    Ok, we’ve managed to pinpoint the issue.
    This happens when using both the Note plugin and Yoast SEO with the sitemaps feature enabled.

    Yoast runs the following:

    if ( false !== stripos( $request_uri, 'sitemap' ) && ( in_array( $extension, array( '.xml', '.xsl' ) ) ) ) {
                            remove_all_actions( 'widgets_init' );
                    }

    This removes the Note class and therefore when it tries to run gives a 500 error. This only happens when Google tries to read the sitemap files.

    On your plugin, on the line that says:

    if ( ! class_exists( 'Note_Customizer' ) ) {

    We’ve changed it to:

    if ( class_exists( 'Note_Widget' ) && ! class_exists( 'Note_Customizer' ) ) {

    This goes around the problem, not sure if with unforeseen consequences. Maybe you could comment on that, if this is the proper way to do it and the fix could be included in next updates for Note.

    Thanks.

    Plugin Author Slocum Studio

    (@slocumstudio)

    Hi Luis,

    Thanks for all of your effort to determine the source of this error. We just pushed an update with a fix. We also mentioned your name in the release notes :).

    We have run into this issue previously in our premium Conductor plugin with Yoast and your fix was close to the one that we decided to implement.

    In the end, since we only needed to grab our Note Widget id_base, we decided to add a function_exists( 'Note_Widget' ) call before our $note_widget variable in the Note_Customizer class. We then check if that variable is set and use the id_base found in the Note Widget.

    Let us know if you have any other questions or concerns.

    Thanks,
    Scott

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Call to undefined function note_widget()’ is closed to new replies.