0
0
Wordpressframework~10 mins

Why performance impacts user experience in Wordpress - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to add a caching plugin in WordPress to improve performance.

Wordpress
add_action('[1]', 'wp_cache_set');
Drag options to blanks, or click blank then click option'
Athe_content
Btemplate_redirect
Cwp_cache
Dinit
Attempts:
3 left
💡 Hint
Common Mistakes
Using hooks that run too late, causing no caching effect.
Choosing hooks unrelated to page loading.
2fill in blank
medium

Complete the code to enqueue a minified CSS file for faster loading in WordPress.

Wordpress
wp_enqueue_style('theme-style', get_template_directory_uri() . '/style[1].css');
Drag options to blanks, or click blank then click option'
A.min
B-min
C_min
Dmin
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect suffixes that don't match the actual file name.
Forgetting the dot before 'min'.
3fill in blank
hard

Fix the error in the code to defer JavaScript loading for better performance.

Wordpress
function defer_scripts($tag, $handle) {
  if ($handle === '[1]') {
    return str_replace(' src', ' defer src', $tag);
  }
  return $tag;
}
add_filter('script_loader_tag', 'defer_scripts', 10, 2);
Drag options to blanks, or click blank then click option'
Amain-js
Bjquery
Cstyle
Dwp_head
Attempts:
3 left
💡 Hint
Common Mistakes
Using handles for CSS or unrelated scripts.
Using WordPress core handles like 'jquery' without need.
4fill in blank
hard

Fill both blanks to create a function that limits post revisions to improve database performance.

Wordpress
function limit_revisions([1]) {
  return [2];
}
add_filter('wp_revisions_to_keep', 'limit_revisions');
Drag options to blanks, or click blank then click option'
A$num
B3
C10
D$limit
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined variable names.
Returning a string instead of an integer.
5fill in blank
hard

Fill all three blanks to register a custom image size and enable it in WordPress theme.

Wordpress
add_image_size('[1]', [2], [3], true);
add_filter('image_size_names_choose', function($sizes) {
  return array_merge($sizes, ['[1]' => 'Custom Size']);
});
Drag options to blanks, or click blank then click option'
Acustom-thumb
B150
Dmedium
Attempts:
3 left
💡 Hint
Common Mistakes
Using existing size names like 'medium'.
Using strings instead of numbers for dimensions.