Skip to content

Instantly share code, notes, and snippets.

@mtmail
mtmail / geocode-parallel.php
Created December 15, 2018 18:56
parallel geocoding using PHP
#!/usr/bin/php
<?php
// 1. install https://github.com/stil/curl-easy
//
// composer require stil/curl-easy
//
// 2. fill a text file 'queries.txt' with queries, e.g.
// Berlin
// Madrid
@mattclements
mattclements / function.php
Last active April 16, 2024 17:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@hampusn
hampusn / wpml-detach-duplicates.sql
Created June 11, 2015 07:39
SQL queries to detach WPML duplicates and translate them separately.
# Select all posts which are duplicates of a language.
# The language parameter is to only select by the new language (not the original duplication language).
SET @lang_code = 'da';
SELECT pm.*, p.post_title, p.post_type, icl.language_code
FROM wp_postmeta pm
INNER JOIN wp_icl_translations icl ON icl.element_id = pm.post_id
INNER JOIN wp_posts p ON p.`ID` = pm.post_id
WHERE meta_key='_icl_lang_duplicate_of' AND icl.language_code = @lang_code;