You could just run DELETE FROM wp_terms WHERE slug LIKE "museum-%"
on you MySQL server, but that would probably leave some orphan rows in wp_term_taxonomy
and potentially in wp_term_relationships
if you have used the terms. While being a bit more complicated I would recommend deleting them using the WordPress API. Something like this might work (from memory, so I’m not 100 percent on the usage of the term_
prefix in $term->term_slug
and $term->term_id
):
$terms = get_terms(array('your_term'), array('name__like' => 'Museum'));
foreach ($terms as $term) {
if (term->term_slug != 'Museum') {
wp_delete_term($term->term_id, 'your_term');
}
}
It’s apparently not possible to search for terms by slug, so be carful not to delete terms like “Museums” or “Museum of Natural History” which will happen if you run the above code.
Related Posts:
- What is the difference between an ORM and an ODM?
- Rename a table in MySQL
- How should I tackle –secure-file-priv in MySQL?
- Can’t connect to MySQL server on ‘127.0.0.1’ (10061) (2003)
- Keeping WP database synced across multiple developers using git
- How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?
- How to define composite keys with dbDelta()
- Is it possible to define two databases for one installation?
- Connect forms in WP to external database
- Hook into $wpdb
- How to get site URL if database is disconnected?
- Is it wise to delete post revisions and autosaves from database?
- Improve or optimize a very slow query
- Multiple WP install with same users database
- Using two different DB users on one WP install
- Usage of Direct Database Call Without Caching Error
- Can I transfer a mysql database to another site?
- MySQL Syntax Error upon restoring database from backup [closed]
- Weird issue with database migration and SSL links
- Merge two databases: OLD SITE -> NEW SITE
- Backup another database with BackUpWordPress plugin [closed]
- Easiest Way to Authenticate WP Users Using an External DB?
- How to use a different database to list and manage comments in the backend
- How to check if a core update, like 4.9.8 → 5.0, involves a database update (migration)?
- Error establishing a database connection on Installation
- Why is it that not all users have a ‘session_tokens’ meta_key record in the usermeta table?
- How do I find out the full path of a page’s template?
- I need to get an array from the wordpress database
- Moving minor updates between local and live sites – just database?
- what is the best way to store user created data?
- Use mulitple usernames?
- Routine to convert custom post meta from old to new value
- “The link you followed has expired” & “Error while saving” messages when adding new post
- input data and output table [closed]
- sanitize POST arrays
- WP character encoding error after sharing post on Facebook �
- Sending data with multi step form to wp database
- WordPress query is not returning proper results
- Localhost to Staging to Development Dynamic WP-CONFIG
- WordPress and user security
- Migrating from PDO using SQLite to clean new install using MySQL
- Selectively restoring original posts from a compromised site to a freshly installed WordPress database
- can we add extra table or column in wordpress for adding our data
- Change WordPress URL in sql file via Terminal
- $wpdb->insert Giving duplicates
- My options table is huge. What can I do?
- Where is phpMyAdmin inside WordPress?
- Changing root password in PHPMyAdmin for WordPress Database when going live
- How to properly check if a table exists in WordPress Database using Show Tables Query
- How to delete database without using any plugin?
- multiple wordpress installation with shared usertable on an different database
- Insert Custom Data into wpusers
- Fill custom select field with pages/post titles
- Is my way to change WordPress server is correct?
- Recovering the table wp_usermeta from users
- WordPress database products structure
- What unexpected data might be stored in terms table and related tables?
- Files on Localhost, Database on Server
- No users table in WordPress’s database
- Copying blog from root to /folder (Not moving)
- How to restore an option_value with serialized data from backup data
- Replacing javascript link in WordPress database without getting mysql syntax errors
- How can i restore a WordPress site with the DB and WordPress Files
- User input to database
- What structure and database storage method should I use for temporary storage that may be written concurrently?
- how to access 2nd Mysqli Database from different server for wordpress
- Error establishing a database connection – WordPress setup, everything else is working
- Restore of database doesn’t show content
- Why theme settings lost when I installed https
- Change user_nickname for author page link
- What is recommended data type and encryption type for password in a database
- Error establishing a database connection with XAMPP
- WordPress users table missing indexes
- How to map data on CSV to web pages?
- unable to use my wordpress site after moving
- How to add download link from database on custom page template?
- Search and replace http:// to https:// 10x my database size
- Database size for news publishers?
- WordPress URL error for links
- Search and Replace in Windows XAMPP site
- How to get the id of recently registered user from database?
- How can i syn wordpress user table with a stand-alone php script?
- Cloned site not connecting to database – MAMP
- How can we speed up wp_get_nav_menu_items()?
- WordPress Database Posts Table query
- How to use separate database on differrent server with different username and password in wordpress for users data
- Generating an HTML table from an array based on dynamic key values
- Mysql Queries per Visit – Crazy High
- Media Library doesn’t allow uploads? Upload Directory
- Split posts between databases
- Moving Site: Is Re-downloading Files After Changing URLs necessary?
- using same mysql user with many databases
- What’s wrong with my $wpdb query?
- Why are my WordPress post queries so slow?
- Moving database from WP 2.6 to 3.5 problem
- How do I find posts?
- wp_usermeta key problem
- How to properly configure SSL connection to remote azure database for running queries within a WordPress environment
- Database Queries are crashing the server
- Uploading to WordPress Database