This file contains 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 | |
/** | |
* ACF object caching | |
* | |
* Adds Object caching support to ACF so taht it doesn't have to recalculate all of | |
* its data on each page load. It can substantially improve performance on sites that | |
* heavily use ACF. | |
* | |
* This is NOT multisite compatible. ACF uses an alternative data structure for multisites. | |
* Its internal APIs don't support an external tool to cache all of the multisite data. |
This file contains 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
... | |
echo "Ready to deploy to Pantheon" | |
if [[ $CI_BRANCH != $DEFAULT_BRANCH ]] | |
then | |
echo "Pushing to a multidev environment." | |
ENV_EXISTS=$(terminus env:list "$TERMINUS_SITE" --field=id | grep "^$TERMINUS_ENV$" || true) | |
if [[ $ENV_EXISTS ]] |
This file contains 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
find /path/to/starting/directory -mindepth 1 -type d -exec bash -c 'echo -n "{}: "; find "{}" -maxdepth 1 -type f | wc -l' \; |
This file contains 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 | |
// Instance of the batch processing job. | |
$job = MyBatchJob(); | |
// How many failed attempts do you want to process. | |
$batch_max_attempts = 3; | |
add_action( 'action_scheduler_failed_execution', 'maybe_retry_failed_batch' ); | |
add_action( 'action_scheduler_failed_action', 'maybe_retry_failed_batch' ); |
This file contains 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
<fieldType name="text" class="solr.TextField" positionIncrementGap="100"> | |
<analyzer type="index"> | |
<tokenizer class="solr.WhitespaceTokenizerFactory"/> | |
<filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> | |
<filter class="solr.LowerCaseFilterFactory"/> | |
<!-- filter class="solr.EnglishPorterFilterFactory" protected="protwords.txt"/ --> | |
<filter class="solr.SnowballPorterFilterFactory" protected="protwords.txt" language="English"/> | |
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/> | |
<filter class="solr.GermanNormalizationFilterFactory"/> | |
</analyzer> |
This file contains 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
# Continuous Integration to a WP Engine install | |
# PHP CircleCI 2.1 configuration file | |
# Requirements: | |
# 1. In CircleCI settings, add environment variables for your site's installs: | |
# * WPE_PRODUCTION_INSTALL=thenameofyourproductioninstall | |
# * WPE_STAGING_INSTALL=thenameofyourstaginginstall | |
# * WPE_DEVELOPMENT_INSTALL=thenameofyourdevelopmentinstall | |
# 2. In your repo, have two files | |
# * `./.gitignores/__default` -- Excludes any compiled files |
This file contains 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 | |
/** | |
* Helper function to remove a directory and all its contents. | |
* PHP requires you to remove each file individually and delete | |
* a directory only when it's empty. | |
* | |
* @param string $path Absolute path to a directory. | |
*/ | |
function remove_directory( $path ) { | |
$files = glob( $path . '/*' ); |
This file contains 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 | |
/** | |
* Sunrise - load very early. | |
*/ | |
/** | |
* If the request is for a file, send it to the legacy ms-files.php for processing. | |
* | |
* File requests follow the pattern `multisite.com/sitename/files/2022/06/filename.jpg` | |
*/ |
This file contains 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 | |
/** | |
* Stop htaccess rewrites | |
* | |
* @package wpengine-stop-htaccess-rewrites | |
* @author wpengine | |
* @license Proprietary | |
* | |
* @wordpress-muplugin | |
* Plugin Name: Stop htaccess rewrites |
This file contains 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
"use strict"; | |
"undefined" == typeof window.console && (window.console = { log: function () {}, debug: function () {} }); | |
"undefined" == typeof JSON && (JSON = { stringify: function () {}, parse: function () {} }); | |
Array.prototype.indexOf || | |
(Array.prototype.indexOf = function (e) { | |
var t = this.length >>> 0, | |
n = Number(arguments[1]) || 0; | |
n = 0 > n ? Math.ceil(n) : Math.floor(n); | |
0 > n && (n += t); | |
for (; t > n; n++) if (n in this && this[n] === e) return n; |
NewerOlder