Custom Sidebars Warning: Missing argument 2 for apply_filters()

Hello,

I am getting the following error message inside my widgets and above my header on the site. I am using multi site but the errors are only being displayed on http://myinsurancepage.com/.

Warning: Missing argument 2 for apply_filters(), called in /custom-sidebars/inc/class-custom-sidebars-visibility.php on line 750 and defined in /wp-includes/plugin.php on line 177

I have followed the instructions outlined in this thread but the error is still present.
https://premium.wpmudev.org/forums/topic/error-message-in-widget-window-when-using-sidebars-pro#post-893786

Any thoughts?

Support access is ACTIVE until September 15, 2015 4:32 pm

Thanks,
William

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    The error and warnings should not enabled on live site. They are solely for developers for development purposes.

    Please add below code in wp-config.php file replacing define('WP_DEBUG', true); .

    // Enable WP_DEBUG mode
    define('WP_DEBUG', true);
    // Enable Debug logging to the /wp-content/debug.log file
    define('WP_DEBUG_LOG', true);
    // Disable display of errors and warnings
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors',0);

    This should fix the problem.

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • William
    • Syntax Hero

    Hi @Sajid

    This is not a live site yet. We are still in the developing process. I understand how to turn off debugging but there is an obvious problem with the Custom Sidebars Pro plugin. I am looking for a fix for that (not how to turn off debug mode).

    Support access is ACTIVE until September 17, 2015 10:02 am

    Thanks,
    WIlliam

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    To fix this error message I have a patch for you. Please download the attached .zip file, unzip and upload it following directory via FTP.

    /wp-content/plugins/custom-sidebars/inc/

    Hope that helps :slight_smile:

    Cheers, Sajid

  • William
    • Syntax Hero

    Hi @Sajid

    The problem is still persisting....

    As stated above:

    I have followed the instructions outlined in this thread but the error is still present.
    https://premium.wpmudev.org/forums/topic/error-message-in-widget-window-when-using-sidebars-pro#post-893786

    The zip you provided me here is the exact same code as provided in the thread above and I already stated that it did not work...

    Could you please take a closer look for me?

    Support access is ACTIVE until September 20, 2015 9:40 am

    Thanks,
    William

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    I am sorry, I did not saw you found that thread already.Sorry!

    Support access would not work. Please send me FTP details so I can make changes in file. You can send in these details in following format via our private contact form.

    Subject: "Attn: Sajid Javed"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    I have fixed the issue by editing class-custom-sidebars-visibility.php file on following location.

    /wp-content/plugins/custom-sidebars/inc/

    Replaced following code:
    if ( apply_filters( 'ms_active' ) ) {

    With this one:
    if ( apply_filters( 'ms_active', '' ) ) {

    On line number 750.

    Hope it helps :slight_smile: Feel free to post a reply or start new thread if you need further assistance.

    Cheers, Sajid

  • William
    • Syntax Hero

    Hi @Sajid,

    I may have spoke to soon... I am getting an error on one of the other networks sites now (not the main site anymore).

    Error:
    Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use
    __construct()
    instead. in /home/naoia/naoia.com/wp-includes/functions.php on line 3457

    Screen shot attached.

    Thanks,
    William

  • William
    • Syntax Hero

    Hi @Sajid,

    I am also geting this error on other pages on MyInsurancePage.

    Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use

    __construct()

    instead. in /home/naoia/naoia.com/wp-includes/functions.php on line 3457

    Notice: Trying to get property of non-object in /home/naoia/naoia.com/wp-content/plugins/directory/core/core.php on line 227

    Notice: Trying to get property of non-object in /home/naoia/naoia.com/wp-content/plugins/directory/core/core.php on line 235

    Notice: Trying to get property of non-object in /home/naoia/naoia.com/wp-content/plugins/directory/core/core.php on line 238

    Notice: Trying to get property of non-object in /home/naoia/naoia.com/wp-content/plugins/directory/core/core.php on line 238

    Notice: Undefined index: post_content in /home/naoia/naoia.com/wp-content/plugins/directory/core/core.php on line 800

    Thanks,
    William

  • William
    • Syntax Hero

    @Sajid,

    I just tried to register a new user (M2 Membership) on naoia.com (the main site) and got the following error as well as a white screen.

    Notice: wp_new_user_notification was called with an argument that is deprecated since version 4.3.1 with no alternative available. in /home/naoia/naoia.com/wp-includes/functions.php on line 3572

    Warning: Cannot modify header information - headers already sent by (output started at /home/naoia/naoia.com/wp-includes/functions.php:3572) in /home/naoia/naoia.com/wp-includes/pluggable.php on line 1207

    I was not getting these error before you updated class-custom-sidebars-visibility.php. Please help.

    Thanks,
    William

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    I am sorry in delay of my response on this ticket.

    Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct() instead. in /home/naoia/naoia.com/wp-includes/functions.php on line 3457

    Its WP notice of chaging the way it registers widgets now. I am going to ping developer for this issue to get insights on how we are looking at it. Meanwhile I found this thread on wp.org that should work for you.
    https://wordpress.org/support/topic/notice-wp_widget-is-deprecated-since-version-430

    I just tried to register a new user (M2 Membership) on naoia.com (the main site) and got the following error as well as a white screen.

    This should not occur due the change I made in plugin file. However I have restored the plugin file to original.

    Please test again and let me know how it goes :slight_smile:

    Cheers, Sajid

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    I am not certainly sure about your theme or other plugins but for Custom Sidebars Pro plugin the developer says you have to edit customsidebars.php (main plugin file) on line number 68. Change:
    parent::WP_Widget(...)
    to:
    parent::__construct(...)

    Again I would want to suggest you to hide these suggestions, these are solely for developers to improve their code and its completely safe to do so.

    You can hide it by using attached mu-plugin. Download the attached plugin, unzip and move it to wp-content/mu-plugins folder (create if not exists).

    Note: This will not hide warnings and fatal errors but only developer stuff, notices and depreciated messages.

    Hope it helps and you could login now.

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • William
    • Syntax Hero

    Hi @Sajid,

    I uploaded the no-notices.php file and updated the customsidebars.php on line 68. These updates removed most of the issues but im still getting the following above my header:

    Warning: Missing argument 2 for apply_filters(), called in /home/naoia/naoia.com/wp-content/plugins/custom-sidebars/inc/class-custom-sidebars-visibility.php on line 750 and defined in /home/naoia/naoia.com/wp-includes/plugin.php on line 177

    Warning: Missing argument 2 for apply_filters(), called in /home/naoia/naoia.com/wp-content/plugins/custom-sidebars/inc/class-custom-sidebars-visibility.php on line 750 and defined in /home/naoia/naoia.com/wp-includes/plugin.php on line 177

    Thanks,
    William

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    Its the one I fixed before after that you keep getting headers sent error on membership 2 page. So that's why I reverted it back to original and asked you to let me know if you get that error again, to make sure that error caused by this change.
    https://premium.wpmudev.org/forums/topic/custom-sidebars-warning-missing-argument-2-for-apply_filters#post-956415

    Did you checked that again ? If its not working then I will make that change again and this error will go away.

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    Sorry for confusion, yes, that's what I mean.

    I made that change again and tested to register a new user on your main site but did not get fatal error this time. It means that was due to something else.

    All seems good now :slight_smile: Let me know if you are still getting errors.

    Take care and have a nice day :slight_smile:

    Cheers, Sajid

  • Sajid
    • DEV MAN’s Sidekick

    Hi @William

    Hope you are doing good today :slight_smile:

    I am not certainly sure about what actually caused this but I guess, its the WP deprecated warning message that caused this issue. When you disabled all upgrade notices, it started working.

    You are welcome and have a nice day :slight_smile:

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.