Clean WordPress Database Removing Empty Categories

In Web 276 views

LIST EMPTY CATEGORIES

From your PhpMyAdmin installation or via MySql command line tool try running this query.

SELECT
 x.count AS howmany,
 t.name AS name
FROM
 wp_terms AS t,
 wp_term_taxonomy AS x
WHERE
 t.term_id = x.term_id
ORDER BY
 x.count

If you just want to output empty cat, you can use the WHERE statement like shown below

SELECT
 x.count AS howmany,
 t.name AS name
FROM
 wp_terms AS t,
 wp_term_taxonomy AS x
WHERE
 t.term_id = x.term_id AND
 x.count = 0
ORDER BY
 x.count

Del Them All

DELETE t, x
FROM
wp_terms AS t,
wp_term_taxonomy AS x
WHERE
t.term_id = x.term_id AND
x.count = 0

Table Optimization

After such a Delete operation it is good to optimize the affected MySql tables, both to free overhead space and to improve performances. Even if you can perform such operation directly from PhpMyAdmin gui, below is the Sql code to run the optimization.

OPTIMIZE TABLE `bb_terms` , `bb_term_taxonomy`

source : blog.andreaolivato.net

Related Search


Hapus Post Lama di WordPress Melalui PHPMyadmin
Hapus Post Lama di WordPress Melalui PHPMyadmin
Sekelumit tentang perintah langsung di PHPMyadmin sudah
Bypass Internet Positif
Bypass Internet Positif
Buat agan-agan yang sudah capek dengan Internet
Redirect Artikel Pada Domain Lama Ke Domain Baru dengan .htaccess
Redirect Artikel Pada Domain Lama Ke Domain Baru dengan .htaccess
Caranya cukup simple, buat file .htaccess pada
Leverage browser caching for Nginx
Leverage browser caching for Nginx
Apa siy Leverage browser caching ? Ini penjelasan

Top