Why does WordPress use serialize rather than json_encode for the options table? [duplicate]

serialize representation can be stored in text and reversed JSON representation can be stored in text but cannot always be precisely reversed Run this example: $query = new WP_Query(); var_dump( $query ); var_dump( unserialize( serialize( $query ) ) ); var_dump( json_decode( json_encode( $query ) ) ); After going through serialize accurate WP_Query object is re-created. … Read more

Add on the fly tabs to plugin options

WordPress Tabs are non-standard, static html markup. You can only add the markup within your functions.php theme file or inside your plugin. <h2 class=”nav-tab-wrapper”> <a href=”#” class=”nav-tab”>Tab #1</a> <a href=”#” class=”nav-tab nav-tab-active”>Tab #2</a> <a href=”#” class=”nav-tab”>Tab #2</a> </h2> In this helper plugin (WordPress Admin Style) you’ll find the class references for the default markup of … Read more

Difference between Option_Group and Option_Name in Register_Settings

The codex defines the function as: register_setting( $option_group, $option_name, $option_validate_function ); $option_group is settings group name. Use when displaying on a settings page for example $option_name is the database entry name $option_validate_function is the callback for this database entry/this option. Most codex tutorials use an array of data in one $option_name but that’s not required … Read more

Using widget options ‘outside’ the widget

@JonathonByrd’s answer is probably ‘best’ – certainly you should using get_option if at all possible, since there’s no guarantee the option name will stay the same between WordPress versions. Similarly – @JonathonByrd also relies on using a global variable which may be removed/renamed (though perhaps very unlikely). Unfortunately there are no public wrappers which we … Read more