Query utili: differenze tra le versioni

Da Webmobili Wiki.
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 1: Riga 1:
''' Trovare gli utenti Admin '''
== Trovare gli utenti Admin ==
<pre>
<pre>
SELECT u.ID, u.user_login, u.user_email
SELECT u.ID, u.user_login, u.user_email
Riga 6: Riga 6:
WHERE um.meta_key = 'wp_capabilities'
WHERE um.meta_key = 'wp_capabilities'
   AND um.meta_value LIKE '%administrator%';
   AND um.meta_value LIKE '%administrator%';
<pre>
</pre>
 
== Woocommerce ==
 
=== Visualizzare Prodotti nel cestino ===
<syntaxhighlight lang="sql">
SELECT p.ID, p.post_title, p.post_status, p.post_type
FROM wp_posts p
WHERE p.post_type = 'product'
  AND p.post_status = 'pending';
 
SELECT p.ID, p.post_title, p.post_status, p.post_type
FROM wp_posts p
WHERE p.post_type = 'product_variation'
  AND p.post_status = 'trash';
</syntaxhighlight>

Versione delle 15:47, 8 ago 2025

Trovare gli utenti Admin

SELECT u.ID, u.user_login, u.user_email
FROM wp_users u
INNER JOIN wp_usermeta um ON u.ID = um.user_id
WHERE um.meta_key = 'wp_capabilities'
  AND um.meta_value LIKE '%administrator%';

Woocommerce

Visualizzare Prodotti nel cestino

SELECT p.ID, p.post_title, p.post_status, p.post_type
FROM wp_posts p
WHERE p.post_type = 'product'
  AND p.post_status = 'pending';

SELECT p.ID, p.post_title, p.post_status, p.post_type
FROM wp_posts p
WHERE p.post_type = 'product_variation'
  AND p.post_status = 'trash';