This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace utkarsh; | |
/** | |
* Restore customizer which is removed by WP Core. | |
*/ | |
function restore_customizer() { | |
// WP version is 5.9 beta or later than only add customize.php back. | |
if ( ! version_compare( get_bloginfo( 'version' ), '5.9-beta', '>=' ) ) { | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const hiddenImageOrigin = "s3 url without trailing shash" | |
const requestURL = new URL(request.url) | |
// Append the request path such as "/assets/image1.jpg" to the hiddenImageOrigin. | |
// You could also process the path to add or remove directories, modify filenames, etc. | |
const imageURL = hiddenImageOrigin + requestURL.pathname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Return zero updates and current time as last checked time | |
function __disable_wp_updates() { | |
include ABSPATH . WPINC . '/version.php'; | |
return (object) array( | |
'updates' => array(), | |
'version_checked' => $wp_version, | |
'last_checked' => time(), | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function verify_sitemap_urls() { | |
if [ -z "$1" ]; then | |
echo "Usage: check_sitemap [file_path/url] (new_domain)" | |
echo "If no new domain passed it will use the url from sitemap; if domain is passed then it will replace the domain in sitemap url with same path." | |
return | |
fi | |
if [[ "$1" == *"http"* ]]; then | |
TEMPFILE=$(mktemp) | |
# Download the sitemap file from the given URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Root-based Category URLs | |
* Description: Enables root-based Category URLs, i.e. Makes /category/my-category/ URLs route as /my-category/ | |
* Author: Mike Schinkel | |
* Author URI: http://about.me/mikeschinkel | |
* Plugin URI: https://gist.github.com/1421235 | |
* Version: 0.1.1 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Define an interface | |
interface MyInterface { | |
public function myFunction(); | |
} | |
// Define 1000 classes that implement the interface | |
for ($i = 1; $i <= 100000; $i++) { | |
$className = 'MyClass' . $i; | |
eval(" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Merge and Push on Label | |
on: | |
pull_request_target: | |
types: [labeled] | |
jobs: | |
auto-merge-and-push: | |
runs-on: ubuntu-latest | |
if: github.event.label.name == 'In dev' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin name: Redirect canonical to home URL for trailing slash. | |
* Description: Fix for WordPress network site with different homeurl and site address with reverse proxy, which redirects non-trailing slash to site address instead of home url. | |
* Version: 1.0 | |
* Author: Utkarsh | |
* Author URI: https://utkarshpatel.com | |
* License: GPLv2 or later | |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Disable jetpack sync. | |
*/ | |
add_filter( 'jetpack_sync_modules', '__return_empty_array', PHP_INT_MAX ); |