Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tott's full-sized avatar

Thorsten Ott tott

  • Germany, Cologne area
View GitHub Profile
@felipeelia
felipeelia / ep-add-cross-fields.php
Last active December 10, 2021 19:25
ElasticPress: Make Elasticsearch search for the string in different fields
<?php
/**
* Add a cross_field type clause to the ES query, so it searches for terms
* in different fields.
*
* @param array $query Current query
* @param array $args Query variables
* @param string $search_text Search text
* @param array $search_fields Search fields
@Viper007Bond
Viper007Bond / whatissoslow.php
Last active October 29, 2023 14:23
WordPress: Times how long it takes each filter and action to run and displays results at the end of the page. Quick and dirty.
<?php
/**
* This little class records how long it takes each WordPress action or filter
* to execute which gives a good indicator of what hooks are being slow.
* You can then debug those hooks to see what hooked functions are causing problems.
*
* This class does NOT time the core WordPress code that is being run between hooks.
* You could use similar code to this that doesn't have an end processor to do that.
*
@nb
nb / class-query-iterator.php
Created November 12, 2012 15:34
WordPress Chunk Query Iterators
<?php
/**
* Iterates over results of a query, split into many queries via LIMIT and OFFSET
*/
class QueryIterator implements Iterator {
var $limit = 500;
var $query = '';
var $global_index = 0;