Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#24138 closed enhancement (maybelater)

Add Constant control for Multisite.

Reported by: krembo99 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Multisite Keywords:
Focuses: Cc:


Not sure if this should be tagged as feature request or enhancement.

WordPress is now making quite an extensive use of constants (like AUTOSAVE_INTERVAL , WP_POST_REVISIONS or EMPTY_TRASH_DAYS ) that are configured in wp-config.php in the form of define('EMPTY_TRASH_DAYS', 1 ); .

Right now, AFAIK , there is no way to define those variable on a site-to-site (or blog-to-blog) basis in Multisite mode.

So for example if one wants his main blog to empty trash every 3 days, while another blog to be set to 5 , or even allow and enable DEBUG_MODE on a certain blog , while keeping it disabled in others , is not currently possible (again, AFAIK) .

Now, I am not sure this should be done with constants , or with some new functions , or simply in some settings implementation, or even with some kind of a blog-based config.php for each blog , but it sure would be a necessary layer of control to have ( if indeed the Multisite feature is to be kept alive and expanded ..)

Change History (5)

#1 @Ipstenu
2 years ago

You don't have to put the defines in wp-config. You can put them in a plugin, for example, so with the possible exception of debug mode, you should be able to control them per site that way.

http://wordpress.org/extend/plugins/revision-control/ for example :)

#2 @krembo99
2 years ago

I know they could be defined anywhere , but since this is a multisite , regardless of the actual location where they are defined ,those constants will affect ALL blogs ( unless specifically defined or treated otherwise ).. I am also not sure how does a defined constant will act upon conflicts where the same constant is sharing a name but different in value. which will take priority ? (or the constant will just keep on "switching" and "bouncing" from one value to the other ) . Also, constants that are cron - dependent ( like trash or auto-save ) would be entering a bit of a conflict ( as to my understanding )

Version 2, edited 2 years ago by krembo99 (previous) (next) (diff)

#3 @Ipstenu
2 years ago

Nested ifs. Where and how you define them is the magic sauce :)

if ( $blog_id == 2 ) { define('EMPTY_TRASH_DAYS', 1 ); }

Which actually you could do in the wp-config, IIRC, and have a graceful fallback if not defined. I see people do that for having multiple blogs with different settings in one wp-config.php (stored outside of root) all the time. It's weird, but cool.

Sounds like a pretty awesome Multisite Plugin, actually. Most people who run a network assume they know better (and care more) about DB things than the people on the network (and they're probably right). So leaving the Super Admin to be the one who decides what's what is sensible.

#4 @nacin
2 years ago

We're trying to move away constants as much as possible, and this is one such reason.

For example WP_POST_REVISIONS is now confined to wp_revisions_to_keep() (which has a filter) and wp_revisions_enabled().

#5 @jeremyfelt
2 years ago

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

Closing as there isn't much actionable here. Workarounds are possible and the issue is more related to a general philosophy that WordPress has going forward.

Note: See TracTickets for help on using tickets.