View Examples
## From permalink "Day and Name (/%year%/%monthnum%/%day%/%postname%/)" to "postname"
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)$ http://www.yourwebsite.com/$4
## From permalink "Month and Name (/%year%/%monthnum%/%postname%/)" to "postname"
RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ http://www.yourwebsite.com/$3
## From permalink "Numeric (/archives/%post_id%)" to "postname"
RedirectMatch 301 ^/archives/(\d+)$ http://www.yourwebsite.com/?p=$1
View WordPress Plugin Dynamic Prerender Meta Tag
<?php
/*
Plugin Name: EVE Dynamic Prerender Meta Tag
Plugin URI: https://www.evemilano.com/2017/11/wp-prerender-plugin/
Version: 3.3
Description: This WordPress plugin creates and inject into HTML head a Dynamic Prerender Meta Tag. The system stores users navigational paths inside the database e retrieve the most common next visited page as prerender meta tag. If the plugin doesn't has data for the next probable page, it will show a prerender to the homepage. The database table WILL BE REMOVED automatically when the plugin is uninstalled but not when disabled. Do not remove the plugin if you want to keep data. The database table can grow up a lot in large websites, keep an eye on it!
Author: Giovanni Sacheli
Author URI: https://www.evemilano.com/
*/
View Da usare nel file functions.php
//* ---------------------- DISABLE REST API ---------------------- *//
add_action( 'after_setup_theme', 'remove_json_api' );
function remove_json_api () {
// Remove the REST API lines from the HTML Header
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
// Remove the REST API endpoint.
View Service Worker Registration
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('Registration successful, scope is:', registration.scope);
})
.catch(function(error) {
console.log('Service worker registration failed, error:', error);
});
}
View Link Rel Manifest
View sw.js
/*
* EVE Milano sw.js
* Copyright 2017 Giovanni Sacheli All rights reserved.
* Version 1.2 (20 settembre 2017)
*/
self.addEventListener('install', e => {
console.log('PWA Service Worker installing.');
let timeStamp = Date.now();
e.waitUntil(
View Manifest.json
{
"short_name": "EVE Milano",
"name": "EVE Milano Consulenza SEO",
"icons": [
{
"src": "/wp-content/uploads/apple-icons/apple-touch-icon-48x48.png",
"type": "image/png",
"sizes": "48x48"
},
{
View absolute link
View relative link
View Add this to the functions.php
function add_defer_attribute($tag, $handle) {
// add script handles to the array below
$scripts_to_defer = array('jquery-migrate', 'hoverIntent', 'superfish', 'superfish-args', 'skip-links', 'wp-embed');
foreach($scripts_to_defer as $defer_script) {
if ($defer_script === $handle) {
return str_replace(' src', ' defer="defer" src', $tag);
}
}
return $tag;