Bird
0
0

A developer added this to the child theme's functions.php:

medium📝 Debug Q6 of 15
Wordpress - Theme Structure and Basics
A developer added this to the child theme's functions.php:
<?php
wp_enqueue_style('parent-style', get_stylesheet_directory_uri() . '/style.css');

Why might this cause a problem?
AIt loads the parent stylesheet twice
BIt loads the child stylesheet instead of the parent stylesheet
CIt causes a syntax error due to missing function wrapper
DIt prevents any stylesheets from loading
Step-by-Step Solution
Solution:
  1. Step 1: Understand get_stylesheet_directory_uri()

    This function returns the child theme directory URL, not the parent.
  2. Step 2: Effect on enqueued style

    Using it to load 'parent-style' actually loads child style, causing confusion.
  3. Final Answer:

    It loads the child stylesheet instead of the parent stylesheet -> Option B
  4. Quick Check:

    get_stylesheet_directory_uri() points to child theme [OK]
Quick Trick: Use get_template_directory_uri() for parent styles [OK]
Common Mistakes:
MISTAKES
  • Confusing get_stylesheet_directory_uri() with parent path
  • Not wrapping enqueue in a function hooked to action
  • Assuming no effect from wrong URI function

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes