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

Best practices for a Style/CSS based theme options page?

creating a custom script that writes to the static CSS file is a bad idea!!! you would need to regenerate the file each time you save any changes. a better solution would be to save all options in an array of options say for example: $MyCSS[‘background_color’] = #009988; $MyCSS[‘background_repeat’] = no-repeat; update_option(‘theme_settings’,$MyCSS); and that why … 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

Prevent/Disable Automatic Update Check

How to disable core auto updates but enable plugins and themes auto updates If you want to stop the autoupdates of the WordPress core, but to enable them for your Plugins and/or Themes, you can add these lines in the wp-config.php file: Stop the core auto updates: define( ‘WP_AUTO_UPDATE_CORE’, false ); Then Enable the plugins/themes: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)