Skip to content

Instantly share code, notes, and snippets.

View loorlab's full-sized avatar
💻
💥👩‍🚀👨‍🚀💥

LOOR Lab loorlab

💻
💥👩‍🚀👨‍🚀💥
View GitHub Profile
@loorlab
loorlab / translate_checkout_WOO.php
Created February 25, 2025 03:39
Translate : WooCommerce Checkout Fields
<?php
// Force translate WooCommerce
add_filter('gettext', function($translated, $text, $domain) {
if ($domain === 'woocommerce') {
$translations = [
'Billing details' => 'Detalles de facturación',
'First name' => 'Nombre',
'Last name' => 'Apellido',
'Company name' => 'Nombre de la empresa',
'Country / Region' => 'País / Región',
@loorlab
loorlab / query_mysql_total_posts_exclude_pages_cpt_WP.sql
Created February 11, 2025 00:14
Query - MySQL - WordPress | Display all Posts exclude pages and other content type
SELECT
p.ID,
p.post_title,
p.post_status,
CONCAT(u.option_value, '/', p.post_name, '/') AS permalink
FROM
wp_posts p
JOIN
wp_options u
ON u.option_name = 'siteurl'
export default class EventEmitter
{
constructor()
{
this.callbacks = {}
this.callbacks.base = {}
}
on(_names, callback)
{
@loorlab
loorlab / query_mysql_total_posts_by_no_category_permalinks_WP.sql
Created January 20, 2025 08:35
Query - MySQL - WordPress | Total Posts by No Category and Permalinks
@loorlab
loorlab / datasets
Created December 27, 2024 21:46
Datasets
https://www.datos.gov.co/en/
https://datosabiertos.esri.co/
https://datosabiertos.bogota.gov.co/dataset
https://datos.icde.gov.co/
@loorlab
loorlab / query_mysql_total_posts_by_no_category_WP.sql
Created December 22, 2024 05:39
Query - MySQL - WordPress | Total Posts by No Category
SELECT p.ID, p.post_title, p.post_date
FROM wp_posts p
LEFT JOIN wp_term_relationships tr ON p.ID = tr.object_id
LEFT JOIN wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id AND tt.taxonomy = 'category'
WHERE p.post_type = 'post'
AND p.post_status = 'publish'
AND tt.term_taxonomy_id IS NULL;
@loorlab
loorlab / php_fatal_error_memory_WP_CLI.md
Last active November 14, 2024 00:45
PHP Fatal error: Allowed memory size of xx bytes exhausted (tried to allocate xx bytes) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Extractor.php on line 100 | WP CLI

Error

$ wp core download

[12-May-2022 06:07:40 UTC] PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 36864 bytes) in phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Extractor.php on line 100

Solution

$ php -d memory_limit=512M "$(which wp)" core download --locale=es_ES

@loorlab
loorlab / query_mysql_total_posts_by_category_WP.sql
Created November 8, 2024 15:15
Query - MySQL - WordPress | Total Posts by category
SELECT
COUNT(p.ID) AS total_contenidos
FROM
wp_posts p
JOIN
wp_term_relationships tr ON p.ID = tr.object_id
JOIN
wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
JOIN
wp_terms t ON tt.term_id = t.term_id
@loorlab
loorlab / query_mysql_search_keyword_WP.sql
Last active November 8, 2024 15:13
Query - MySQL - WordPress | Search Keyword
SELECT
p.ID,
CONCAT(o.option_value, '/', p.post_name, '/') AS post_url
FROM
wp_posts p
JOIN
wp_options o ON o.option_name = 'siteurl'
WHERE
p.post_status = 'publish'
AND p.post_type = 'post'
@loorlab
loorlab / query_mysql_change_status_post_private_to_publish_WP.sql
Created October 14, 2024 01:21
Query - MySQL - WordPress | Change Status Private to Publish
UPDATE wp_posts
SET post_status = 'publish'
WHERE ID IN (
2804, 2808, 2812, 2816, 2821, 2823, 8676, 8677, 8678, 8701, 8702, 2829, 2831, 2833,
2836, 2838, 2840, 2842, 2844, 2846, 2848, 2850, 2852, 2854, 2856, 2858, 2860, 2862,
2864, 2868, 2959, 2961, 2963, 2965, 2968, 2970, 2972, 2974, 2976, 2978, 2980, 2982,
2985, 2987, 4368, 4370, 4375, 4377, 4379, 4381, 4383, 4389, 4393, 4395, 4397, 4399,
4401, 4403, 4405, 8564, 8566, 8567, 8565, 8568, 8569, 8570, 8571, 8572, 8573, 8883,
8884, 8885, 8886, 8887, 8888, 8951, 8952, 8953, 8954, 8956, 8957, 8958, 8959, 8960,
8961, 8955, 8962, 8963, 8964, 9094, 9095, 9096, 9097, 9098, 9099, 9100, 9101, 9102,