WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#19503 closed enhancement

Add major core version global for easier plugin/theme development — at Version 3

Reported by: johnjamesjacoby Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:

Description (last modified by johnjamesjacoby)

Problem:

Plugin/theme authors cannot reliably use $wp_version when doing their own feature development without hitting a chicken-egg scenario.


Example:

I want a plugin to call function foo_32() for all major WordPress 3.2 branch versions.

I want a plugin to call function foo_33() for all major WordPress 3.3 branch versions.

3.2.1 is greater than 3.2

3.3-RC2 is less than 3.3

version_compare() is inadequate for this when used in conjunction with core's versioning scheme.


Paradox:

version_compare( '3.2', $wp_version ); -- Fails when 3.2.1 comes out

version_compare( '3.3', $wp_version ); -- Fails before 3.3 is released

Using version_compare() with any combination of operators yields the same result.


Proposed Solution:

A new global: $wp_major_version

This would get bumped in trunk when development starts on the next major version. It provides plugin and theme authors the luxury of not needing to parse the major version out of $wp_version themselves. Patch attached.

Change History (4)

@johnjamesjacoby4 years ago

comment:1 @johnjamesjacoby4 years ago

  • Summary changed from Add major core version global for easier plugin feature development to Add major core version global for easier plugin/theme development

comment:2 @johnjamesjacoby4 years ago

  • Description modified (diff)

comment:3 @johnjamesjacoby4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.