Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new hook for preload #47

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/wp-rocket-helpers.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified cache/wp-rocket-cache-feed/wp-rocket-cache-feed.zip
Binary file not shown.
12 changes: 12 additions & 0 deletions cache/wp-rocket-cache-feed/wp-rocket-cache-feed/inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,15 @@ function wp_rocket_cache_feed_notice() {
unset( $_GET['activate'] );
}
}

/**
* Added feed urls to the preload.
*
* @param string[] $urls urls to add to the preload.
* @return string[]
*/
function wp_rocket_preload_feeds($urls) {
$feed_url = get_feed_link();
$urls []= $feed_url;
return $urls;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ function wp_rocket_cache_feed_maybe_deactivate() {
}
add_action( 'admin_init', 'wp_rocket_cache_feed_maybe_deactivate' );



/**
* Run when plugin is activated
*
Expand All @@ -63,6 +65,8 @@ function wp_rocket_cache_feed_activate() {
}
register_activation_hook( __FILE__, 'wp_rocket_cache_feed_activate' );

add_filter( 'rocket_preload_load_custom_urls', 'wp_rocket_preload_feeds' );

/**
* Run when plugin is deactivated
*
Expand Down