-
Find out the ID of the category that you want to assign. You’ll see it in the URL when editing the category (URL will be something like
?taxonomy=category&tag_ID=3&post_type=post, here 3 is the ID) -
Assuming that the ID is 3, you can now run this query in your database (eg via PHPMyAdmin)
INSERT IGNORE INTO wp_term_relationships (object_id, term_taxonomy_id) ( SELECT DISTINCT ID, 3 FROM wp_posts WHERE post_type="post" AND post_status="publish" );
If you use a different prefix than wp_, be sure to change it. Also change the 3 to the ID you want.
Related Posts:
- How do I show data from gravity forms in my template? [closed]
- Is it bad practice to create own table for a plugin?
- How to Add an Index to Plugin Database table
- How can I delete orphan keys in WordPress database tables?
- Is there a plugin that will override the “Error establishing a database connection” message? [closed]
- What are these entries in the database? Looks similar to JSON
- Creating two database tables via plugin
- How to properly insert data into custom table via plugin
- How does WordPress handle MySQL row lock errors?
- How to make sense of the active_plugins option_value to enable and disable certain plugins from the database?
- How to empty wordpress custom post Database table
- insert data in database table from plugin with WP3.1
- $wpdb->get_results leaking memory
- Insert query inserts 2 entries, should insert 1
- Is it a bad practice to go directly to the mysql database while developing a plugin?
- Updating WordPress – the best approach (updating wp core, plugins and db)
- How to store ACF custom fields data in a custom table
- Bad Request (Invalid Hostname) on working server, database problem
- Plugin Not Working, But Only On GoDaddy Hosted site
- Custom database table for plugin not creating on activation
- WordPress plugin DB upgrade
- Should I global $wpdb outside of any of my plugin’s functions scope?
- Ajax with jQuery UI dialog not working
- How to edit/delete single row items in a table on my own menu page
- greatest() function returns undefined property
- Is the wordpress user-model changed in wpmu?
- Default Plugin Settings Not Writing to Database
- Creating Tables on Network Activation
- Unable to create new database table upon plugin activation using dbDelta
- Where to hook my plugin’s action
- How to determine what is generating large amount of database queries?
- Building an email signup form. Where should the information be saved in the DB?
- Retrieving a Value from a wp-database
- Need help restoring my WordPress blog
- WP plugins for building a database?
- Plugin Options Not Saving to Database in WP 4.5
- Doubt using $wpbd->get_col for a single column
- Access WordPress database outside of WordPress
- Is it possible to create Custom Post plug-in?
- WordPress Settings Lost After Site Migration
- Help With MySQL to WPDB Query Conversion
- Delete query not working in plugin
- How to remove traces from widget during uninstallation
- How do I network enable a plugin for a multisite install via the database?
- import posts with dutch/special letters
- How can I change the meta_key for a particular piece of information?
- Create a table with wordpress plugin boilerplate
- WordPress and a secondary database?
- “Master” WordPress Multisite – Database Sync
- Better ads plugin has 500.000 entries in wp_postmeta
- How to create multiple database tables on plugin activation?
- Does deleting a Plugin via the WordPress admin ‘completely’ remove the code?
- Creating a CSV with PHP inside the plugin directory
- after wordpress update to 3.5+ i get many errors in plugin wpdb::prepare()
- WPDB: Update table
- Making my plugin create a page?
- Best/Correct way to add an option to a category
- How to create plugin/ page that reads from database
- DB Query not working in Plugin
- Where do plugin variables live in the db?
- Plugin: connect to external database without showing password
- Storing Form data in a different database
- How to add a custom form to a plugin’s setting page
- update_option creates an option, which empties on a blog reload
- More than one WordPress site using the same database – how to disable plugin for one site?
- How to get specific column data conditionally in database in WordPress?
- What database state changes happen after a post is manually “updated” with no changes?
- Can i stream data to a custom_post_type?
- How do I add a medium to the WordPress database with my own plugin?
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- $wpdb->insert not working inside save_post tag
- Get Shortcode output to database for static post_content
- Store GravityForm data in phpmyadmin (mysql)
- My wp database has been hacked
- How to update a database entry with a wordpress plugin?
- Accessing data from Google Cloud Datastore in WordPress site
- How can I store user preferences in WordPress and retreive them later?
- Enable plugins that are “not supported”
- Database error when user logs in
- one admin for 2 wordpress websites
- My plugin can’t see my files
- Need help for creating custom table on wordpress
- Show a table from data submitted by a form from a user
- How to save information related to post in database?
- Create user assessment and use results in sql query
- WordPress custom posttype meta values doesnot save
- Insert data in custom table during new post creation
- Managing database tables in WordPress multisite
- How to submit the custom form data in database in WordPress without plugin?
- Is it safe to increase/alter the size of the wp_post.guid column from VARCHAR(255) to VARCHAR(2048)?
- Duplicator live to wamp https to http
- Website keeps going down, is it a plugin, database, memory problem, or something else?
- Is it possible to recover Deleted users?
- User register hook can’t access form request
- On the same site, how do I send data from a plugin file to a theme file?
- Fragmented Static Conversion of WordPress Pages
- Very slow page loads
- Form with response button after on table after submission
- Can’t save formdata in DB
- Can’t change login logo & css – older plugin data blocking?