Tag Info

Hot answers tagged

12

I don't think there is a universal URL hook. There are a lot of hooks and I may have missed it, but I don't think there is one. You can look through the hooks at adambrown.info. There are a lot of URL hooks, but not a universal one. If I may suggest another solution: Log the errors to a files. /** * This will log all errors notices and warnings to a file ...


8

Even though my first approach was for the garbage bin and s_ha_dums answer is a clean, and probably the best, way of going about it, let me offer one more working scenario: The following sets a cookie that is valid for the next 24 hours (86400 seconds) when an administrator logs into the system. In wp-config.php, the constant WP_DEBUG is conditionally ...


8

In wp-config.php: if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) define( 'WP_DEBUG', false ); else define( 'WP_DEBUG', true );


5

There are multiple tools and possibilities, and shure it would be nice to have something quick at hand. I know plugin authors who do offer debug flags so you can analyze what's going on quite easy. As for plugins, I have not tested it but looked at some screenshots and it is at least informative: Debug Bar (Wordpress Plugin) and the BlackBox Debug Bar ...


4

You can do this by adding some code to wp-config.php $request_uri = $_SERVER['REQUEST_URI']; $debug_dirs = array ('/debug-dir1/','/debug-dir2/'); // list of directories to turn on debugging foreach ($debug_dirs as $debug_dir) { if (!strncmp($request_uri,$debug_dir,strlen($debug_dir))) { define('WP_DEBUG', true); } } define('WP_DEBUG', ...


4

I don’t know how to move the notices to the bottom or if that’s possible at all. To disable the debug mode in wp-admin write in wp-config.php: define( 'WP_DEBUG', FALSE === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' ) ); Untested: You could try to enable warnings in admin with: // happens early in wp-admin/admin.php add_filter( ...


3

It is not possible to turn on WP_DEBUG because it's defined in wp-config.php by default, redefinition of defined constants is not possible in PHP. If you want to keep them out of wp-config.php ask them to add to the top something like: if ( file_exists( 'safe-wp-config.php' ) ) { /* this will contains WP_DEBUG */ include 'safe-wp-config.php'; } ...


3

Turn off WP_DEBUG because it overwrite your ini_set.


3

It doesn't answer your question precisely, but from personal experience I found it is better to enable debug mode by matching IP address instead of URL. That requires to modification of links and solves how to identify admin before WP loads required user functionality.


2

I've used Theme Check in the past and found it very good. If I recall correctly, it checks against deprecated functions but most of all it suggests better functions to future-proof your theme, and alerts you when you're forgetting to implement features which WordPress' users have learnt to rely on.


2

WordPress logic forces WP_DEBUG to be defined to something, even if it's omitted it will be set to false in wp_initial_constants() during load. However "background" (that is not when it is checked explicitly) function of WP_DEBUG is to be a flag for how PHP error reporting should be configured on runtime. That configuration is performed by wp_debug_mode() ...


2

You have several tools at your disposal when working with native WordPress debugging. PHP Debugging - WP_DEBUG is the native WordPress PHP constant for debugging WordPress errors. It sets PHP's error reporting to to E_ALL for warnings when deprecated functions are used and if none are found it sets it to E_ALL ^ E_NOTICE ^ E_USER_NOTICE. So most of the ...


2

When WP_DEBUG is set, WordPress sets (via wp_debug_mode() call early in core load process) the error reporting level to E_ALL & ~E_DEPRECATED & ~E_STRICT. This means all warnings and errors except strict errors and PHP deprecated functions (not WordPress ones). You can define your own level in a custom mu-plugin (the override needs to be called as ...


2

A little bit of simple debugging and everything is clear. $REQUEST['action'] is set in this case, so my first guess wasn't true, but... Its value is 'save' and not 'page' nor 'reset'. So your code does exactly nothing, because there is no if part for such value;


2

Add var_dump($value); at the beggining of this loop. I'm pretty sure that not all options have id property and it may be some other bug... To get rid of these notices, your code should look like so: foreach ($options as $value) { if ( array_key_exists('id', $value) ) { if (isset($_REQUEST[ $value['id'] ] ) ) { //#997 update_option( ...


1

Themes are required to use add_theme_page() in the Wordpress Theme Directory. You need: add_theme_page( $this->strings['page_title'], // Page title $this->strings['menu_title'], // Menu title 'edit_theme_options', // Capability $this->menu, // Menu slug array( ...


1

File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. The WordPress coding styles require that you make use of the WP Filesystem instead of using direct PHP file functions. You can replace your file_get_contents call easily with: $response = wp_remote_get($feed_url); $file_content = $response['body']; For more ...


1

You should not need to call wp_debug_mode() yourself, it's called very early in the process of wp-settings.php. Perhaps you are defining the WP_DEBUG constant too late? It should be defined in the wp-config.php file, not anywhere else.


1

This issue has been reported here : trac Sometimes, HTTP requests fail. In this case, in particular, on localhost. That's part of the reason why we suppress them. I've personally never seen this. I think it's isolated to this server configuration. (Nacin)


1

The quickest way to do this is just using grep for the function name in it's theme/plugin folder. If your on windows you can use grepWin or agent ransack/powershell, etc. Also install debug-bar, it's a lot nicer to look at.


1

What you're looking for is the Log Deprecated Notices plugin. (Don't run it on a production site, as it is a direct-to-database log.) What it'll do is convert those cryptic messages that are likely to reference has_cap() or some line in functions.php, to what's actually going on. The Debug Bar plugin is also nice. It tracks notices of that pageload, using ...


1

Because I somehow dropped a file called "index.html" in my WordPress install. How'd I find out? I created a completely fresh installation and used diff to compare them.


1

To make sure that the index.php will be loaded first add the following line to your .htaccess: DirectoryIndex index.php index.html This tells Apache to ignore an index.html if an index.php exists.


1

If $query->query_vars['suppress_filters'] is not set you will get that message. Use empty($query->query_vars['suppress_filters']) instead of false == $query->query_vars['suppress_filters'] ) or use $query->get('suppress_filters') like this false == $query->get('suppress_filters'). Untested (minimally tested) but I believe either of those ...


1

just to be on the safe side use: if (array_key_exists('no_cat_base', $myoptions) && isset($myoptions['no_cat_base'])){ //do your thing }


1

You don't indicate what your server arrangement is. If you are in a shared hosting environment you have limited options. If it's your own server, then you can install various profiling tools to get the Big Picture. Look at this thread over on SO for some options. Also, slowness of the delivered page can be the result of a lot of things, only a few of which ...


1

XHProf (open source, part of Facebook stack for their performance monitoring) is pain to setup (at least for Windows person like me), but it's very thorough and convenient performance profiler tool for PHP. I wish it had win version for my local test stack. :(


1

I can only recommend the Krumo php class that can be added within 10 sec to any installation and doesn't depend on any local setup. So even if you're out and away of your office you got a debug tool with you. Just be sure to load it after any other files and load it with if ( current_user_can('manage_options') ) krumo::enable(); so no guest or other user ...


1

Try to disable/suppress all error warnings/notices in your wp-config.php (on top). Anyway: Errors are nothing bad. They give you a chance to fix your code.


1

WP_DEBUG has no impact on PHP error output. In addition to error_reporting setting, set display_errors=0 in your php.ini file. It's enabled by default for development. But you'll want it off on production servers.



Only top voted, non community-wiki answers of a minimum length are eligible