Plugin options autoloading

Quite personally I disagree with the author of the book to an extent. If you are auto-loading multiple options in your database when WordPress is initialising it’s doing a lookup that looks like this: *”SELECT option_name, option_value FROM wp_options WHERE autoload = ‘yes’”* — at the beginning. Now, imagine if you had 40 options, that’s … Read more

Plugin options will not save in database

…because your input (POST) name needs to match the one in your register_setting call: register_setting( ‘first_tab_options’, ‘first_tab_items’ ); …. <input type=”text” name=”first_tab_items”… Otherwise how the hell does WP know that some_name in POST holds your option data? 😉

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

Options for CDN with WordPress Including Supporting Plugins?

Amazon CloudFront Amazon CloudFront is an CDN ‘wrapper’ around Amazon’s S3 service. Distributions can be created from existing S3 buckets, and when a file is requested from it’s CloudFront URL it is either served from the nearest edge locations’s cache or fetched from S3 and cached. Plugins My CDN – handles URL rewriting of JS, … Read more