Query utili: differenze tra le versioni
Da Webmobili Wiki.
Nessun oggetto della modifica |
|||
| Riga 9: | Riga 9: | ||
== Woocommerce == | == Woocommerce == | ||
Stati del prodotti: | |||
* publish | |||
* draft | |||
* pending | |||
* trash | |||
=== Visualizzare Prodotti nel cestino === | === Visualizzare Prodotti nel cestino === | ||
| Riga 20: | Riga 26: | ||
FROM wp_posts p | FROM wp_posts p | ||
WHERE p.post_type = 'product_variation' | WHERE p.post_type = 'product_variation' | ||
AND p.post_status = 'trash'; | |||
</syntaxhighlight> | |||
=== Eliminazioni prodotti da Cestino === | |||
<syntaxhighlight lang="sql"> | |||
DELETE p, pm, tr | |||
FROM wp_posts p | |||
LEFT JOIN wp_postmeta pm ON p.ID = pm.post_id | |||
LEFT JOIN wp_term_relationships tr ON p.ID = tr.object_id | |||
WHERE p.post_type = 'product' | |||
AND p.post_status = 'trash'; | AND p.post_status = 'trash'; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Versione delle 15:49, 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
Stati del prodotti:
- publish
- draft
- pending
- trash
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';
Eliminazioni prodotti da Cestino
DELETE p, pm, tr
FROM wp_posts p
LEFT JOIN wp_postmeta pm ON p.ID = pm.post_id
LEFT JOIN wp_term_relationships tr ON p.ID = tr.object_id
WHERE p.post_type = 'product'
AND p.post_status = 'trash';