Last active
August 29, 2015 14:05
-
-
Save birgire/789a2964f4ccfe832b58 to your computer and use it in GitHub Desktop.
WooCommerce Product Attributes - Dump them in a metabox for debugging
This file contains hidden or 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: Product Attributes - Debug | |
* Description: Dump the product attributes in a metabox. | |
* Author: birgire | |
* Author URI: Https://github.com/birgire | |
* Version: 0.0.1 | |
*/ | |
// PHP 5.3.3+ | |
/** | |
* Metabox to display debug info on product attributes | |
*/ | |
add_action( 'add_meta_boxes', | |
function(){ | |
add_meta_box( | |
'birgire_debug', | |
'Product Attributes - Debug', | |
'birgire_meta_box_callback', | |
'product' | |
); | |
} | |
); | |
/** | |
* Metabox callback | |
*/ | |
function birgire_meta_box_callback( $post ) | |
{ | |
$product_attributes = (array) get_post_meta( $post->ID, '_product_attributes' ); | |
printf( '<pre>%s</pre>', | |
print_r( $product_attributes, 1 ) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment