WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 7 weeks ago

#42980 closed enhancement (duplicate)

get_plugin_data does not support PHP Version

Reported by: dshanske Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords: good-first-bug
Focuses: Cc:
PR Number:

Description

Related #40934

While the debate over #40934 continues on how to implement this in WordPress, the Requires PHP header became a thing in August.

https://make.wordpress.org/plugins/2017/08/29/minimum-php-version-requirement/

So, get_plugin_data should return it. Then, while the Core team debates how Core should implement the support, plugin authors can use it if needed.

Seems easy enough.

Change History (5)

#1 @dd32
2 years ago

get_plugin_data() returns the data from the plugin .php headers, where as the requires php header is in the readme.txt.

Plugins can read the data directly using get_file_data() and specifying arbitrary header names, so I'm not sure anything is needed here yet?

#2 @dshanske
2 years ago

I'm going to kick myself for not thinking of that. However, I still think that plugin data should get all the data. So maybe I should suggest it also parse the readme?

#3 @dd32
23 months ago

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

I don't think this is in scope of get_plugin_data() which returns the php headers.

Perhaps this could be proposed as a separate ticket, however, there'd need to be a need for it in core for it to be accepted.

I'm going to close this ticket as invalid for now.

#4 follow-up: @wpscholar
7 weeks ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

@dd32 The WordPress handbook indicates that Requires PHP and Requires at least are both valid plugin headers: https://developer.wordpress.org/plugins/plugin-basics/header-requirements/

Either we need to update the documentation, or we should add both of these new plugin headers to the get_plugin_data() function.

#5 in reply to: ↑ 4 @dd32
7 weeks ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

Replying to wpscholar:

@dd32 The WordPress handbook indicates that Requires PHP and Requires at least are both valid plugin headers: https://developer.wordpress.org/plugins/plugin-basics/header-requirements/

Either we need to update the documentation, or we should add both of these new plugin headers to the get_plugin_data() function.

That wasn't the case 21 months ago :)

This has since been implemented through #46938.

Note: See TracTickets for help on using tickets.