The data in the options table is stored as serialized arrays. Use get_option()
to get the data and unserialize them.
array_walk(
get_option( 'widget_text' ),
function( $d ){
if ( ! empty( $d['title'] ) ) {
printf( '<p>Title: %s<br>Text: %s</p>', $d['title'], htmlentities( $d['text'] ) );
}
}
);
If you need a complete plugin, use this. It’s a simple debug-plugin. Upload, activate and go to the dashboard. After activation there should be a Debug-Widget. If not, open the screen options and activate the Debug-Widget.
<?php
/*
Plugin Name: __WPSE__
Description: Testing plugincode
*/
add_action( 'plugins_loaded', function(){ new TestPlugin; } );
class TestPlugin {
public function __construct(){
add_action( 'wp_dashboard_setup', array( $this, 'add_dashboard_widget' ) );
}
public function add_dashboard_widget(){
wp_add_dashboard_widget(
'debug-widget',
'Debug Widget',
array( $this, 'output' ),
$control_callback = null
);
}
public function output(){
echo '<div class="wrap">';
array_walk(
get_option( 'widget_text' ),
function( $d ){
if ( ! empty( $d['title'] ) )
printf( '<p>Title: %s<br>Text: %s</p>', $d['title'], htmlentities( $d['text'] ) );
}
);
echo '</div>';
}
}