This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`) | |
VALUES ('newuserid', MD5('pass123'), 'First Name Last Name', 'email@email.com', '0'); | |
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) | |
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}'); | |
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) | |
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE FROM wp_woocommerce_order_itemmeta; | |
DELETE FROM wp_woocommerce_order_items; | |
DELETE FROM wp_comments WHERE comment_type = 'order_note'; | |
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' ); | |
DELETE FROM wp_posts WHERE post_type = 'shop_order'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tar -zcvf wp-content.tar.gz --exclude="wp-content/uploads" wp-content/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function stripslashes_deep( $value ) { | |
$value = is_array( $value ) ? array_map( 'stripslashes_deep', $value ) : stripslashes( $value ); | |
return $value; | |
} | |
function fgr_grabar_meta( $post_id, $array_data ) { | |
$new_data = maybe_serialize( stripslashes_deep( $array_sata ) ); | |
update_post_meta( $post_id, 'fgr_meta', $new_data ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_available_payment_gateways', 'fgr_desactivar_metodos_de_pago' ); | |
function fgr_desactivar_metodos_de_pago( $available_gateways ) { | |
if ( ! is_checkout() ) return $available_gateways; | |
$unset = false; | |
$items = WC()->cart->get_cart(); | |
foreach ( $items as $item => $values ) { | |
$producto = $values['data']; | |
$attribute = $producto->get_attribute('pa_atributo'); | |
if ( 'Mi atributo' === $attribute ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$ | |
RewriteRule ^(.*)$ https://sitioproduccion.com/$1 [QSA,L] | |
# Para entornos NGINX me ha funcionado poner lo siguiente en la configuración | |
location ~* ^.+\.(svg|svgz|jpg|jpeg|gif|png|ico|bmp|pdf)$ { | |
try_files $uri @image_fallback; | |
} | |
location @image_fallback { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$curl = curl_init(); | |
curl_setopt_array( | |
$curl, | |
array( | |
CURLOPT_URL => "https://example.com/wp-json/wp/v2/evento?fields=id,title,modified_gmt,validate,status,from,until,location,web&per_page=20", | |
CURLOPT_RETURNTRANSFER => true, | |
CURLINFO_HEADER_OUT => true, | |
CURLOPT_ENCODING => "", | |
CURLOPT_MAXREDIRS => 10, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $wpdb; | |
$table_name = $wpdb->prefix . 'prueba_tabla'; | |
$wpdb_collate = $wpdb->collate; | |
$sql = | |
"CREATE TABLE {$table_name} ( | |
id mediumint(8) unsigned NOT NULL auto_increment , | |
nombre varchar(255) NULL, | |
PRIMARY KEY (id), | |
KEY first (nombre) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Call the First Image in a Post (Used in the Open Graph Call Below) | |
function catch_first_image() { | |
global $post, $posts; | |
$first_img = ''; | |
ob_start(); | |
ob_end_clean(); | |
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); | |
$first_img = $matches [1] [0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |