Bird
0
0

Which of the following is the correct way to start a simple WordPress plugin file?

easy📝 Syntax Q3 of 15
Wordpress - Plugins and Extensibility
Which of the following is the correct way to start a simple WordPress plugin file?
Afunction my_plugin() { echo 'Hello'; }\n?>
B<plugin>My Plugin</plugin>
C<?php echo 'Plugin'; ?>
D<?php\n/*\nPlugin Name: My Plugin\n*/\nfunction my_plugin_function() {\n // code here\n}\n?>
Step-by-Step Solution
Solution:
  1. Step 1: Recognize WordPress plugin header format

    WordPress plugins require a PHP comment block with Plugin Name to be recognized.
  2. Step 2: Check for valid PHP syntax

    has proper PHP tags, header comment, and function structure.
  3. Final Answer:

    Correct plugin header with PHP tags and comment block -> Option D
  4. Quick Check:

    Plugin header + PHP = [OK]
Quick Trick: Plugin files start with PHP and header comment [OK]
Common Mistakes:
  • Using HTML tags instead of PHP
  • Missing plugin header comment
  • Not opening PHP tag

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes