• Hi all,

    After login the website on Internet, following warning popup.

    Deprecated: Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead. in /home1/nowgolic/lesousvide.com/wp-includes/functions.php on line 6121

    Warning: Cannot modify header information – headers already sent by (output started at /home1/nowgolic/lesousvide.com/wp-includes/functions.php:6121) in /home1/nowgolic/lesousvide.com/wp-includes/functions.php on line 7168
    https://lesousvide.com/wp-admin/admin.php?page=WordfenceScan
    Warning: Cannot modify header information – headers already sent by (output started at /home1/nowgolic/lesousvide.com/wp-includes/functions.php:6121) in /home1/nowgolic/lesousvide.com/wp-includes/functions.php on line 7144

    Warning: Cannot modify header information – headers already sent by (output started at /home1/nowgolic/lesousvide.com/wp-includes/functions.php:6121) in /home1/nowgolic/lesousvide.com/wp-admin/admin-header.php on line 14

    Warning: Cannot modify header information – headers already sent by (output started at /home1/nowgolic/lesousvide.com/wp-includes/functions.php:6121) in /home1/nowgolic/lesousvide.com/wp-includes/option.php on line 1740

    Warning: Cannot modify header information – headers already sent by (output started at /home1/nowgolic/lesousvide.com/wp-includes/functions.php:6121) in /home1/nowgolic/lesousvide.com/wp-includes/option.php on line 1741

    Please advise how to correct them? Thanks in advance

    Regards

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @satimis,

    I hope you’re doing well.

    Deprecated: Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.

    It means the function has_cap is deprecated from the code or plugin. Currently, the logs are generating from the WordPress core; there is no theme or function mentioned.

    First, you need to find which plugin, theme, or code is causing the issue because I can see the site has WP 6.8.1, which was released just 17 hours ago.

    To find out what is responsible, you will need to create a site backup and start deactivating the plugins one by one, keeping track of the results. Do the same with the theme.

    If the deprecated warning disappears after deactivating any plugin or theme, it confirms that it is coming from there.

    You’ll need to try reinstalling a fresh version of the plugin or theme, which is going to help fix the deprecated warning. If you still get the deprecated warnings, then you need to contact the plugin or theme support and share this topic URL. They will understand and will remove the deprecated function from the code and release a new update.

    Please try the test and share the outcome with us.


    Kind Regards,
    Imran Khan

    Thread Starter satimis

    (@satimis)

    Hi @imran,

    Thanks for your advice.

    The warnings mentioned have been there for quite long time. I didn’t find any problems on the website therefore I just leave them there.

    Following plugins are installed:

    Advanced Editor Tools
    All-in-One WP Migration and Backup
    All-in-One WP Migration File Extension
    Classic Editor
    Duplicator
    Google Language Translator
    Limit Login Attempts Reloaded
    Wordfence Security
    YouTube SimpleGallery

    Whether disable them one-by-one to check whether the warning gone? Thanks

    • This reply was modified 6 months, 1 week ago by satimis.

    The warnings you’re seeing on your WordPress website (https://lesousvide.com) are PHP errors related to deprecated functions and header issues caused by early output. Here’s how to fix them: 🔧 1. Fix the Deprecated Function Warning (has_cap)Error:

    Deprecated: Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated.
    

    ✅ Solution:

    This means that a plugin or theme is using an old method (user levels) instead of modern capabilities. This is usually safe to ignore unless you’re seeing actual functionality issues.

    But to suppress the message:

    • Edit wp-config.php (in your site root) and disable debug display:
    define('WP_DEBUG', false); 
    define('WP_DEBUG_DISPLAY', false);
    @ini_set('display_errors', 0);
    

    If you still want to log errors without showing them, you can add:

    define('WP_DEBUG_LOG', true);
    

    🛑 2. Fix “Cannot modify header information – headers already sent”Error:

    Warning: Cannot modify header information – headers already sent by (output started at /path/to/functions.php:6121)
    

    ✅ Solution:

    This happens because some output (like an error or space) was sent before PHP tried to modify headers (e.g., redirect or set cookies). Here’s how to fix it:

    • Step 1: Ensure no whitespace or output before <?php or after ?> in any of these files:
      • /wp-includes/functions.php
      • /wp-includes/option.php
      • /wp-admin/admin-header.php

    Ideally, there should be no ?> at the end of PHP files.

    • Step 2: Fix the root cause — the deprecated warning.
      The warning itself counts as output, causing the headers error. By disabling the display of warnings (as above), the issue should disappear.

    🧩 3. Track the Source Plugin Causing has_cap Warning

    If you want to go deeper and fix the deprecated has_cap usage:

    • Temporarily disable plugins one by one (starting with Wordfence or any custom plugins).
    • Check which one causes the warning.
    • If you’re a developer or have access to one, update that plugin to use modern capabilities instead of numeric user levels.

    ✅ Final Checklist Step Action 1 Edit wp-config.php to suppress errors from showing 2 Remove extra spaces before <?php and after ?> 3 Identify and update/remove outdated plugins or themes 4 Keep WordPress, themes, and plugins up to date

    • This reply was modified 6 months, 1 week ago by Mahmoud Agwa.
    Thread Starter satimis

    (@satimis)

    Hi @mahmoudagwa901

    Lot of thanks for your detail advice.

    The warnings mentioned in my OP have been occurred for several years before. The website seems running without problem. I have posted the warnings here before. A friend here suggested me leaving them there if there are no other problems found.

    I just found below warnings on following page;
    https://lesousvide.com/meat-la-viande/

    Meat – La viande
    Warning: Attempt to read property “title” on string in /home1/nowgolic/lesousvide.com/wp-content/plugins/youtube-simplegallery/inc/shortcode.php on line 153

    Warning: Undefined array key “timthumb” in /home1/nowgolic/lesousvide.com/wp-content/plugins/youtube-simplegallery/inc/shortcode.php on line 157

    Warning: Attempt to read property “title” on string in /home1/nowgolic/lesousvide.com/wp-content/plugins/youtube-simplegallery/inc/shortcode.php on line 153

    Warning: Undefined array key “timthumb” in /home1/nowgolic/lesousvide.com/wp-content/plugins/youtube-simplegallery/inc/shortcode.php on line 157

    What will be your advice ?
    1) Ignore them without taking any action
    OR
    2) Follow your suggestions to fix them?

    Please advise. Thanks

    • This reply was modified 6 months, 1 week ago by satimis.
    Moderator threadi

    (@threadi)

    You can ignore the warnings. However, you can also contact the developers of the plugin causing the warning. The latter are from “youtube-simplegallery” whose support forum you can find here: https://wordpress.org/support/plugin/youtube-simplegallery/

    I also get the message “Function has_cap was called…” with some projects. It is probably caused by faulty data records in the project, which in turn are caused by faulty plugins. If you have been seeing this message for many years, it is difficult to find the actual cause. As long as there are no clear malfunctions in this context, I would recommend ignoring this warning.

    Alternatives to this:

    • Set up the project from scratch. In doing so, you will do without any outdated incorrect data records and you will certainly no longer see these messages (unless a plugin is causing them again).
    • You look for someone who analyzes this for you in depth and finds and fixes the cause if necessary. You can find someone like that here, for example: https://jobs.wordpress.net
    Thread Starter satimis

    (@satimis)

    HI@threadi,

    Thanks for your advice.
    Your are right. The problem is caused by “youtube-simplegallery”. After deactivating this plugin all warnings gone.
    Now I don’t think needing this plugin. I’ll thoroughly check the website before deleting it.

    Thanks

    Regards

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘How to correct the warnings’ is closed to new replies.