Pro features available:

  • Fragment Cache Extension
  • Genesis Extension
  • WPML Extension
  • Full Site Delivery (FSD)
  • Cache Statistics
]]>
Add define('W3TC_PRO_DEV_MODE', true) to wp-config.php and resave the license key.

]]>
cdn-fsd-maxcdn
  1. Select CDN provider of your choice in a "Full site mirroring" group of "CDN type" dropdown on "General Settings" page, select MaxCDN there.
  2. Go to "CDN" page.
  3. Click "Authorize" button
  4. Type in API key of your account. You can obtain by following a link in a popup. Opening that link will you will be prompted for your MaxCDN login and password. Select Zone from the list or choose "Add new" to create new zone (type in some friendly name of zone in that case)
  5. In a zone setup form you will be notified with the settings required for zone. Tou have only 1 editable field is IP address of your WordPress host. W3 Total Cache tries to guess it, but its not possible to know that in all possible cases.
  6. You get success page with information about DNS changes. Now you need to change record of your wordpress host from IP address and replace it to CNAME to specified hostname.
  7. It works

]]>
cdn-fsd-cloudfront
  1. Select CDN provider of your choice in a "Full site mirroring" group of "CDN type" dropdown on "General Settings" page, select CloudFront there.
  2. Go to "CDN" page.
  3. Click "Authorize" button
  4. Type in Access Key and Secret Key of your account.
  5. Select Distribution from the list or choose "Add new" to create new zone (type in some friendly name of zone in that case - that will not be visible anywhere except your AWS control panel)
  6. In a distribution setup form you will be notified with the settings required. Tou have only 1 editable field is alternative hostname of your WordPress host. For example if your have myblog.com website with A record pointint to 1.2.3.4 IP, create another one origin.myblog.com DNS record with A record pointint to 1.2.3.4 IP and type in "origin.myblog.com" in this form.
  7. You get success page with information about DNS changes. Now you need to change record of your wordpress host from IP address and replace it to CNAME to specified hostname.
  8. It works

]]>
First enable Browser Cache and disable "Expires" header. This is because CloudFront does not cache properly when "Expires" headers are set. When using CloudFront and full page caching there are no purging of cached pages when posting new posts etc. Cache invalidations in CF is limited per month and also takes up to 15 minutes to complete.

Since there is no purging and you want to people to be able to comment it is recommended to use a hosted commenting software, such as FaceBook Comments or Disqus. If you do not use this comments are not shown after they been posted or approved.

Main step to get CloudFront full page caching working is to have your site on a different domain than the one you want your visitors to see. So you should install or configure your site so its on a separate domain, for example wp.example.com. You will then later configure example.com so its used by CloudFront.

How to configure CloudFront on AWS:

  1. Go to AWS Console
  2. Click "Create Distribution"
  3. Select "Web"
  4. Click "Continue"
  5. Enter wp.example.com into "Origin Domain Name"
  6. Enter CustomWWW-example.com into "Origin ID"
  7. Set Origin Protocol Policy to HTTP Only (CloudFront will connect to my origin using only HTTP).
  8. Select "Allow HTTP Methods" - GET, HEAD, PUT, PATCH, DELETE, OPTIONS
  9. Select "Forward Query Strings" - Yes
  10. Enter example.com (the domain that your visitors will type into their browser) into Alternate Domain Names(CNAMESs)
  11. Set logging to "On"
  12. Enter "webserverlog-example.com" into "Bucket for logs"
  13. Enter "stats-logs/" into Log Prefix
  14. Enter "CDN for example.com" into Comment.
  15. Click "Create Distribution"

Configure DNS

  1. Add new CNAME recored for example.com that points to the Domain Name that belongs to the distribution you created previously.

How to configure W3 Total Cache:

There are two methods to configure W3 Total Cache CDN. Origin Pull "CloudFront" or "Generic mirror". If you want to be able to invalidate URLs from within WordPress you need to use the CloudFront option. If you do not configure an CDN the wrong URLs will be used when linking to CSS, JS and other files.

Configure CloudFront:

  1. Select Origin Pull (Mirror) Amazon CloudPront on General Page
  2. Go to the CDN page.
  3. Enter your AWS credentials
  4. Enter example.com as an CNAME
  5. Save Settings

Configure Generic Mirror:

  1. Enter example.com into "Replace site's hostname with:"
  2. Save Settings
]]>
You need to enable Fragment Caching and use a theme based on Genesis.

]]>
You need to go the Genesis Extension settings page. There you will a textbox called "Excluded single pages / posts:" there you need to enter the pages that should not be cached by the fragment caching. The exclude textareas support regular expressions so if the pages that are to be excluded are similar you can most likely enter one expression that covers all your pages. For information on regular expression you need to search.

If you have anything dynamic in your widgets area, the sidebar, then you'll need to disable the sidebar caching, or enter pages that should not have their sidedar cached.

]]>
Fragment caching adds new functionality to the WordPress Transients API:

  • Adds support for grouping transients both per blog and site wide
  • Adds support for manual flushing of registered transient groups
  • Adds support for action based flushing of registered transient groups
  • Adds support for caching filters and actions

To make the plugin aware that you group transients see code examples below:

					add_action('w3tc_register_fragment_groups', 'my_plugin_register_groups');

					function my_plugin_register_groups() {
						//blog specific group and an array of actions that will trigger a flush of the group
						w3tc_register_fragment_group('my_plugin_', array('publish_post'), 3600);
						//If using MultiSite Network/site wide specific group and an array of actions that will trigger a flush of the group
						w3tc_register_fragment_group_global('my_plugin_global_', array('edit_site'), 3600);
					}
					function my_plugin_flush_group() {
						//manually flush group.
						w3tc_fragmentcache_flush_group('my_plugin_');
					}

					//Set transients
					function on_some_event() {
						if (false === get_transient('my_plugin_some_key'))
							//my_plugin_ prefix is the group name we registered earlier
							set_transient('my_plugin_some_key', 'blog specific value');
						if (false === get_site_transient('my_plugin_some_key'))
							//my_plugin_site_ prefix is the group name we registered earlier
							set_site_transient('my_plugin_site_some_key', 'site wide specific value');
					}

					// Cache action example
					add_action('theme_post_loop', 'cache_theme_post_loop_start',-999999999);
					add_action('theme_post_loop', 'cache_theme_post_loop_end', 999999999);

					/**
					 * Start outputbuffering
					 */
					function cache_theme_post_loop_start() {
						w3tc_fragmentcache_start('example1', 'examples', 'theme_post_loop');
					}

					/**
					 * Store the output buffer .
					 */
					function cache_theme_post_loop_end() {
						w3tc_fragmentcache_end('example1', 'examples', false);
					}

					// Cache filter example
					add_filter('theme_filter', 'cache_theme_filter_start',-999999999);
					add_filter('theme_filter', 'cache_theme_filter_end', 999999999);
					/**
					 * Start filter buffering and return filter result
					 */
					function cache_theme_filter_start($data) {
						return w3tc_fragmentcache_filter_start('example_filter1', 'examples', $hook, $data);
					}

					/**
					 * Store the filter result and return filter result.
					 */
					function cache_theme_filter_end($data) {
						return w3tc_fragmentcache_filter_end('example_filter1', 'examples', $data);
					}
				
]]>