در بعضی موارد شاهد ایجاد خطاهایی در ووکامرس یا وردپرس هستیم که دلیلش را نمیدانیم و مشکل زیادی هم برای سایت پیش نمیاورند…به گونه ای که اگر متن خطا نمایش داده نشود مشکل فنی پیش نمیاد برای سایت.
مثل خطای زیر:
Warning: sprintf(): Too few arguments in
…/public_html/wp-content/themes/storefront/inc/storefront-template-functions.php
on line 440
در این گونه موارد با استفاده از آموزش زیر میتوانیم نمایش خطا در سایت را مخفی کنیم:
Example wp-config.php for Debugging
The following code, inserted in your wp-config.php file, will log all errors, notices, and warnings to a file called debug.log in the wp-content directory. It will also hide the errors so they do not interrupt page generation.
// 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 ); // Use dev versions of core JS and CSS files (only needed if you are modifying these core files) define( 'SCRIPT_DEBUG', true );
NOTE: You must insert this BEFORE /* That's all, stop editing! Happy blogging. */ in the wp-config.php file
Debugging Plugins
There are many debugging plugins for WordPress that show more information about the internals, either for a specific component or in general. Here are some examples:
منبع:
https://wordpress.org/support/topic/warning-sprintf-too-few-arguments-over-blog-posts/#post-11153147
اولین باشید که نظر می دهید