WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 4 years ago

#28137 closed enhancement (wontfix)

Add constant to disable loading of functions.php

Reported by: nickciske Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: General Keywords:
Focuses: performance Cc:

Description

Setting WP_USE_THEMES = false does not stop loading of the theme functions.php file.

Context:
http://lists.automattic.com/pipermail/wp-hackers/2014-May/048364.html

Suggestion:
WP_DISABLE_THEME_FUNCTIONS being defined suppresses loading of functions.hp in wp-settings.php

Change History (6)

#1 @nacin
8 years ago

I don't see a justification for this in that thread, as indicated in my own reply.

#2 @nickciske
8 years ago

Not even from a performance standpoint?

Some functions.php files are thousands of lines long -- being able to disable that as a plugin developer on an AJAX calls seems like an easy win...

#3 @mordauk
8 years ago

While I don't see a need for a new constant, it does seem logic that if WP_USE_THEMES is defined as false, functions.php wouldn't be loaded from the current theme, since that's part of a theme and we just told WP not to load themes.

#4 @Clorith
7 years ago

  • Version changed from trunk to 3.9

I've always viewed the WP_USE_THEMES constant as an approach to disable theme templates from loading, not to prevent theme functionality altogether.

A common use case for this constant is when calling WP into other projects where you want to get the same data that your site would have, in such a case your site would be dependent on the actions and filters utilized by the theme, and thus so should your external project.

#5 @westi
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I've read through the thread and I don't see a good justification for this either.

The WP_USE_THEMES constant is designed to stop the theme being rendered and not designed to stop the theme configuration to be loaded. Not loading functions.php could lead to the sites key configuration (CPTs, Taxonomies etc) not being loaded.

Closing.

#6 @lougreenwood
4 years ago

In light of WP REST and WP now becoming a viable backend application platform, maybe this should be re-considered?

Note: See TracTickets for help on using tickets.