Skip to content

Instantly share code, notes, and snippets.

View jason-murray's full-sized avatar
🔮

Jason Murray jason-murray

🔮
View GitHub Profile
if (JSON.parse(localStorage.getItem('force-reconsent-finished')) !== true) {
document.cookie = '_vfa=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/';
localStorage.setItem('force-reconsent-finished', 'true');
console.log ('Force Reconsent Complete');
} else {
console.log ('Force Reconsent Not Required');
}
// You can fill the below with lines that cover the paths you want to clear cookies for.
// We found that the issue started around November 4th, so we decided to clear cookies for
// all posts and category pages from October 15th onwards. The list of paths was generated
// by querying the CMS.
// The script also sets and checks a localStorage value to avoid reruns, and will be retired
// from production after a certain amount of time.
const p = [];
@jason-murray
jason-murray / functions.php
Last active May 28, 2023 16:01
Adds all "visible" custom fields to the custom search excerpt for Relevanssi, code is based on the indexing code used in Relevanssi to add these fields to the index.
// Relevanssi add content to custom excerpts.
add_filter('relevanssi_excerpt_content', 'custom_fields_to_excerpts', 10, 3);
function custom_fields_to_excerpts($content, $post, $query) {
$custom_fields = get_post_custom_keys($post->ID);
$remove_underscore_fields = true;
if (is_array($custom_fields)) {
$custom_fields = array_unique($custom_fields); // no reason to index duplicates
foreach ($custom_fields as $field) {