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

How to load WordPress on non WP page?

The shortest way is to load wp-load.php and abort the loading of the template engine (Note: You couldn’t do that, if you’d be loading the header file, like you see it on many sites in the interweb). # No need for the template engine define( ‘WP_USE_THEMES’, false ); # Load WordPress Core // Assuming we’re … 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

What’s the difference between Options & Settings?

The Options API is primarily a database API, allowing you to get and store values in the options table of the database easily. The Settings API is an interface API. It allows you to build settings screens in a manner that will adapt with future changes to the WordPress interface, as well as to handle … Read more

Performance with autoload and the options table

I didn’t find much information about how the autoloaded values are used. There is no special case for autoloaded options, they are used in the same way as else regular options, but lets figure out what autoload column of the options table means. This column determines do we need to fetch an option at the … Read more

How to pass variable to add_settings_section() callback?

if you look at the do_settings_sections function more specifically the line 1164 where the callback function is being executed : call_user_func($section[‘callback’], $section); you can see that the $section array is being passed to the callback function, so you can identify the callback by the $section[‘id’] hope this make since. Update here is an example, if … Read more

how to update serialized options programatically?

WP-CLI is definitely the answer to this after the update to 1.4.0 which introduced the pluck and patch commands for accessing serialized data in WordPress. The pluck command takes this format for grabbing serialized values wp option pluck <key> <key-name> For example in the active_plugins option you can grab first item wp option pluck active_plugins … Read more

How to use checkbox and radio button in options page?

I tend to store multiple options as an array, so i’d have something like this.. <?php $options = get_option( ‘myoption’ ); ?> <input type=”checkbox” name=”myoption[option_one]” value=”1″<?php checked( 1 == $options[‘option_one’] ); ?> /> <input type=”checkbox” name=”myoption[option_two]” value=”1″<?php checked( 1 == $options[‘option_two’] ); ?> /> However it does depend how the callback function that sanitizes the … Read more

How to pass arguments from add_settings_field() to the callback function?

Look at the declaration for the function: function add_settings_field( $id, $title, $callback, $page, $section = ‘default’, $args = array() ) { } The last parameter takes your arguments and passes them to the callback function. Example from my plugin Public Contact Data foreach ($this->fields as $type => $desc) { $handle = $this->option_name . “_$type”; $args … Read more

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