Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #59847, comment 13


Ignore:
Timestamp:
11/08/2023 10:32:18 PM (15 months ago)
Author:
coreyw
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #59847, comment 13

    initial v1  
    11@joemcgill It doesn't appear that resetting the globals would help. It seems that calls to `get_stylesheet_directory()` return an invalid path if called before a certain point (when the theme is setup perhaps).
    22
    3 So, when ACF calls it during it's setup (`plugins_loaded` or similar), `get_stylesheet_directory()` returns the default theme path (`wp-content/themes/whatever`), but any call to that function during `after_setup_theme` returns the correct path (`custom-directory/whatever`).
     3So, when ACF calls it during its setup (`plugins_loaded` or similar), `get_stylesheet_directory()` returns the default theme path (`wp-content/themes/whatever`), but any call to that function during `after_setup_theme` returns the correct path (`custom-directory/whatever`).
    44
    55So this could be the fault of ACF calling the function too early (I've opened a ticket with them to investigate), but there is no mention of this being an issue on the [https://developer.wordpress.org/reference/functions/get_stylesheet_directory/ docs page]. Or, WordPress should be handling this better and not returning an invalid path.