- Install plugin
wp install memcached-is-your-friend
- Add the following to wp-config.php (make sure WP_CACHE_KEY_SALT is defined and set with a random value)
$memcached_servers = array( 'default' => array( 'memcached:11211' ) )
wp install memcached-is-your-friend
$memcached_servers = array( 'default' => array( 'memcached:11211' ) )
<?php | |
use WP_CLI; | |
/** | |
* Paginated Query that performs callback for each iteration. | |
* | |
* @param string $callback Name of the callback function. | |
* @param array $args WP_Query arguments. | |
* @param string $message Message passed to WP CLI make_progress_bar. |
<?php | |
/** | |
* Functionality for modifying and outputting breadcrumbs provided by Yoast. | |
* | |
* @package IPM | |
*/ | |
namespace IPM\Breadcrumbs; | |
/** |
#!/bin/bash | |
for post in $(wp post list --field=ID --url={url} ) | |
do | |
count=$(wp post term list $post 'category' --fields='name' --format="count" --url={url} ) | |
if [ "$count" -gt "1" ] | |
then | |
wp post term remove $post category 'uncategorized' --url={url} | |
fi | |
done |
wp --allow-root db query "select post_content from wp_posts where post_content like '%<img src%';" --skip-column-names --silent | grep -oP "<img\s+.*?src=['\"](.*?)['\"].*?>" | grep -oP "https?://[^\"]*" | sort | uniq
parse_url()
, create a PHP function* to find unique hosts and add first occurence of each to an array of links.$( document ).ajaxComplete( function( event, xhr, settings ) { | |
try { | |
var queryStringArray = settings.data.split('&'); | |
} catch(e) { | |
var queryStringArray = {}; | |
} | |
// only when | |
if ( $.inArray( 'action=add-tag', queryStringArray ) !== -1 ) { | |
const $xml = $( xhr.responseXML ); |
On a recent migration project, one of the requirements was to add a few blockquote styles to the TinyMCE dropdown list to match the editorial process of the old CMS. Wordpress provides a filter to add a secondary or tetriary dropdown, but if you only have a couple additional elements, it seems like bad UX to seperate it from the original dropdown.
Going off a tip from Chancey Mathews, I realized that Wordpress does not send a argument for block_formats
when initializing TinyMCE, thus relying on the defaults. By adding this argument to the tiny_mce_before_init
filter, we can add in our extra elements*:
* Note: since we're overriding the defaults, we need to include the original elements (p, h1-h6..etc)
function mce_formats( $init ) {
Worker information | |
hostname: i-0388d96-precise-production-2-worker-org-docker.travisci.net:d28a5fd8-3589-4295-975d-59cd61e40876 | |
version: v2.5.0 https://github.com/travis-ci/worker/tree/da3a43228dffc0fcca5a46569ca786b22991979f | |
instance: e0656f8:travis:php | |
startup: 518.8849ms | |
system_info | |
Build system information | |
Build language: php | |
Build group: stable | |
Build dist: precise |
<?php | |
private function om_add_nfg_subscription( $args ) { | |
// check if user already exists | |
$user = get_user_by('email', $args['email']); | |
$user_id = $user ? $user->data->ID : null; | |
// register new user if doesn't exist | |
if (! $user_id ) |
$args = array( | |
'expiration' => date( 'Y-m-d 23:59:59', strtotime( 'January 3, 2018', current_time( 'timestamp' ) ) ), | |
'created' => date( 'Y-m-d 23:59:59', strtotime( current_time( 'timestamp' ) ) ), | |
'status' => 'pending', | |
'profile_id' => 0, | |
'transaction_id' => 0, | |
'initial_amount' => 1, | |
'recurring_amount' => 700, | |
'bill_times' => '1', | |
'period' => 'yearly', |