Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions modules/images/fetchpriority/can-load.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* Can load function to determine if the Fetchpriority feature is already available in WordPress core.
*
* @since n.e.x.t
* @package performance-lab
*/

return static function() {
return ! function_exists( 'wp_get_loading_optimization_attributes' );
};
16 changes: 16 additions & 0 deletions modules/images/fetchpriority/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,19 @@ function fetchpriority_render_generator() {
}
}
add_action( 'wp_head', 'fetchpriority_render_generator' );

// Show an admin notice if fetchpriority is already available in WordPress core (only relevant for the standalone plugin).
if ( function_exists( 'wp_get_loading_optimization_attributes' ) && ! str_starts_with( FETCHPRIORITY_VERSION, 'Performance Lab ' ) ) {
add_action(
'admin_notices',
static function() {
?>
<div class="notice notice-warning">
<p>
<?php esc_html_e( 'Fetchpriority is already part of your WordPress version. Please deactivate the Fetchpriority plugin.', 'performance-lab' ); ?>
</p>
</div>
<?php
}
);
}
8 changes: 6 additions & 2 deletions modules/images/fetchpriority/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Contributors: wordpressdotorg
Requires at least: 6.1
Tested up to: 6.2
Tested up to: 6.3
Requires PHP: 5.6
Stable tag: 1.0.0
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: performance, images, fetchpriority
Expand Down Expand Up @@ -47,6 +47,10 @@ Contributions are always welcome! Learn more about how to get involved in the [C

== Changelog ==

= 1.1.0 =

* Display admin notice to deactivate the plugin if feature already available in WordPress core. ([769](https://github.com/WordPress/performance/pull/769))

= 1.0.0 =

* Initial release of the Fetchpriority plugin as a standalone plugin. ([704](https://github.com/WordPress/performance/pull/704))
2 changes: 1 addition & 1 deletion plugins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images/fetchpriority": {
"slug": "fetchpriority",
"version": "1.0.0"
"version": "1.1.0"
},
"images/webp-uploads": {
"slug": "webp-uploads",
Expand Down