Bird
0
0

Given this plugin code snippet, what will be the output on the site title?

medium📝 component behavior Q13 of 15
Wordpress - Plugins and Extensibility
Given this plugin code snippet, what will be the output on the site title?
function change_title($title) {
  return 'Welcome - ' . $title;
}
add_filter('wp_title', 'change_title');
AThere will be a syntax error and the site will break
BThe site title will be replaced completely with 'Welcome - '
CThe site title will not change
DThe site title will start with 'Welcome - ' followed by the original title
Step-by-Step Solution
Solution:
  1. Step 1: Understand the filter function

    The function adds 'Welcome - ' before the original title by returning a new string.
  2. Step 2: Effect of add_filter

    add_filter applies this function to the site title, modifying it but keeping original content.
  3. Final Answer:

    The site title will start with 'Welcome - ' followed by the original title -> Option D
  4. Quick Check:

    Filter prepends text to title [OK]
Quick Trick: Filter functions return modified data, not replace it fully unless coded [OK]
Common Mistakes:
  • Thinking the title is replaced fully
  • Assuming no change happens
  • Expecting syntax errors from correct code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes