Created
June 2, 2014 21:13
-
-
Save franz-josef-kaiser/fbd9f7097b819619c5ed to your computer and use it in GitHub Desktop.
A WordPress plugin to dump image related globals, options and callbacks on shutdown. Use it in a vanilla WP install with no other plugins activated and an empty theme (style.css and empty index.php only).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Plugin Name: (dev) Options and Globals dump on shotdown */ | |
/**/ | |
add_action( 'shutdown', function() | |
{ | |
$defaults = wp_load_alloptions(); | |
foreach ( get_intermediate_image_sizes() as $s ) | |
{ | |
var_dump( "Currently looking at size: {$s}" ); | |
# Dump of attached callbacks | |
$cbs = [ | |
"default_option_{$s}_size_w", | |
"default_option_{$s}_size_h", | |
"default_option_{$s}_crop", | |
]; | |
foreach ( $cbs as $cb ) | |
isset( $GLOBALS['wp_filter'][ $cb ] ) | |
? var_dump( $GLOBALS['wp_filter'][ $cb ] ) | |
: var_dump( "No callback on the options defaults for: {$cb}" ); | |
# Dump of default option values | |
foreach ( [ | |
'size_w', | |
'size_h', | |
'crop', | |
] as $part ) | |
{ | |
# Let's take a look at the default options output: | |
isset( $defaults["{$s}_{$part}"] ) | |
? var_dump( $defaults["{$s}_{$part}"] ) | |
: var_dump( "No default for: {$s}_{$part}" ); | |
# Let's take a look at the option output: | |
var_dump( get_option( "{$s}_{$part}" ) ); | |
} | |
} | |
var_dump( $GLOBALS['_wp_additional_image_sizes'] ); | |
}, PHP_INT_MAX -1 ); | |
/**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment