Batch add tags to posts via phpmyadmin - wordpress - mysql

How would I go about batch assigning tags to posts via phpmyadmin? I have a custom table in my database that contains the postID and one column with a comma separated list of keywords for each post/record. I want to use the keyword column as values for my tags for each post.
Is there any way for me to get those tags over to the wp_term_relationships table using an sql query?
Right now I already have each post assigned to one category (and some posts assigned to two categories)...if that makes any difference....I am dealing with almost 200,000 posts.
Thanks for the help!!

I thought I could do this with sql queries but that is just over my head..so I did some extensive searching for plugins (free plugins that is...).
I came up with this, which is working....
Installed the 'WP Post Corrector' plugin, it is old and not updated anymore but it is working with my 3.5.1 wordpress. I have a massive csv file with 2 columns (ID -> which is the same as my wp post ID, and post_tag -> which is a list of comma separated tags). I split the file up into smaller chuncks so php or the server wouldn't crap out (http://sourceforge.net/projects/splitcsv/) - I made each file have 5000 records.
Yes, it took me about an hour to upload about 40 files, but now it is done.

Related

replacing multiple table information in mysql

I've recently been given the task of maintaining a sports team's website and have encountered a problem which I cannot find the answer.
It uses Nucleus CMS which is fine and I'm used to it, unfortunately, the domain name has changed and all links and files within the site stored in the mysql database are now out of date and not the correct one.
I am able to manually alter each item using the admin panel of the CMS, but with several thousand posts, that task is daunting.
Is there a way I can do a "replace" domain1.com to domain2.com in the item table in one process through the mysql database?
Forgive me if I'm not using the correct terminology.
Try this:
UPDATE tbl SET domain_name = 'domain2.com' WHERE domain_name = 'domain1.com';

MYSQL Replace data in a column via csv

Sorry if this is a duplicate question but Im not quote sure what Im looking for when it comes to MYSQL terminology. Im a WP Developer so this is a little new to me.
I have my _postmeta table with a load of different meta fields. One particular is called "Description". I have downloaded the CSV and replaced the data in the Description content. I now have a CSV with three columns (POST ID, Meta Key (all description) & Meta Value). What I want to do is to use PHPMyAdmin to run a query to update all the current meta values with the content I now have in my CSV.
Your help is much appreciated.
Thanks

How do I delete ContentTypes in Bolt.cm?

I've just installed Bolt CMS and it offered to generate some sample content, which I did. So now there are 3 contenttypes: pages, entries, and showcases.
I want to keep the pages and entries but don't want the showcases. How do I remove them? I can remove the section from the contenttypes.yml file and they disappear from the front-end, but it still leaves the bolt_showcases table in the database, and also 'showcases' rows in other tables like bolt_taxonomy.
Do I need to delete all this manually? How do I make sure I've removed all traces of an old contenttype?
Contenttype records are limited to a single table. The only thing that escapes that boundary is taxonomy relationships.
To achieve what you want, delete the Showcase records in the UI, that will remove the relationships, if any, then you can safely drop the bolt_showcases table.

"is_visible" flag location for Woocommerce products attributes

This matter is driving me crazy as after wasting days going through my DB I've still been unable to find out an answer to the following question:
Where is the flag "is_visible" stored on the mysql DB for the attributes of Woocommerce products?
I checked all the tables 1000 times but I can't understand where and how the flag option "attribute visible on the product page" is stored on the Wordpress DB.
Thanks!
Enrico
the data is sotered in the postmeta table. However it is not quite straight forward to handle it. If you pick a product and do a search for the product ID as post_id you will see a record with the meta_key _product_attributes. In the meta value you will find a serialised array of the attributes including is_visible.
Just be careful because if you simply edit it in phpmyadmin you can mess stuff up badly. If you don't know what a serialised array is google it.
In case someone is searching for this in the year 2022 or later: In the meantime woocommerce isn't storing this value in the post_meta table. Instead there is a taxonomy called "product_visibility" with different states (exclude-from-catalog, exclude-from-search). In the "term_relationships" table is stored which of these values is associated with a product.

mysql db structure for better performance

I'm not a professional, but I'm messing around with wordpress trying to customize it the way I want it to work...
I've a necessity to add additional data to single-posts, specifically a restaurant menu, each post will have unique menu displayed in sidebar.
Single post is a single row in wp_posts table.
I'm adding additional info using wp metabox functionality, which has its own table called wp_postmeta.
This table is different from wp_posts because it can contain many rows of meta information for a single post.
My questions:
Is this implementation slow?
Will it cause problems if db grows?
Why would wp guyz implement this in this way?
Would not it be wiser to have single meta column and multiple rows per post?
I see that you have "price_list_heading", "price_list_category","price_list_heading1", "price_list_category1","price_list_heading2", "price_list_category2","price_list_heading3" and "price_list_category3" I don't know why, but I think you shouldn't do that, you need to create a relational table with index (I don't know if Wordpress let you do that)
it'd will look like: this will depend of the cardinality of your APP
Let's say that 1 post meta can have multiple categories and multiple categories can be with one postmeta (cardinality N:M)
Now If one post can have multiple categories and one category can have only one post
Where wp_postmeta_copy1 is a FK from ws_postmeta table (id)
Please take a look to this documentation :
http://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model
http://www.inf.unibz.it/~franconi/teaching/2000/ct481/er-modelling/
http://searchsqlserver.techtarget.com/definition/entity-relationship-model