Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to specify the CDN URL in the WordPress configuration.
Wordpress
define('CDN_URL', '[1]');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using local paths instead of full URLs
Using non-HTTP protocols like FTP
✗ Incorrect
The CDN URL must be a valid HTTPS URL pointing to the CDN domain.
2fill in blank
mediumComplete the code to enqueue a CSS file from the CDN in WordPress.
Wordpress
wp_enqueue_style('theme-style', [1] . 'style.css');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using local theme or plugin URLs instead of CDN URL
✗ Incorrect
To load assets from the CDN, use the CDN_URL constant followed by the file path.
3fill in blank
hardFix the error in the code to rewrite asset URLs to use the CDN in WordPress.
Wordpress
function rewrite_asset_url($url) {
return preg_replace('/^[1]/', CDN_URL, $url);
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using relative paths instead of full URL in regex
Missing protocol in regex pattern
✗ Incorrect
The regex must match the full original URL prefix to replace it with the CDN URL.
4fill in blank
hardFill both blanks to correctly filter WordPress content URLs to use the CDN.
Wordpress
add_filter('the_content', function($content) { return str_replace([1], [2], $content); });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Replacing wrong paths like theme or plugin URLs
✗ Incorrect
Replace the original site upload URL with the CDN upload URL in content.
5fill in blank
hardFill all three blanks to configure WordPress to serve static assets from the CDN.
Wordpress
$cdn_assets = [
'[1]',
'[2]',
'[3]'
]; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Including admin CSS directory
Missing common asset directories
✗ Incorrect
Common static asset directories to serve via CDN include uploads, js, and themes.