Using MySQL on here

Today I went to try and clean things up a little bit since I haven’t really done that in some time. At least it feels that way to me. I looked at the comments and realized there were some in the trash. I didn’t think much of it since you know it’s just trash.

There was one time where the comment was from a real person so that was also part of the reason I went and looked.

I saw there were quite a few being posted on images. I thought a little odd but not too crazy since those are to an extend considered posts. Or at least a post type. Yeah. About that.

So I wanted to see how I could just mass disable all of those without having to resort to a plugin because that’s always the solution, right? Not having to use a plugin is the best thing in the world. You would think.

Anyway.

So I set to figure out a filter and of course there was one. I didn’t want to go that route since I honestly wanted to try something a little different. So I tried to see if it could be done using a query. A database query to be a bit more exact.

The cool part was that I really was able to do that and for my site it really only took about less than a second to do. There were only about 75 or so media files that had an open setting. Well, attachments to be precise on that.

The reason I say “attachment” is because that’s how WordPress stores that information in the database. For those who may want to do the same, the query I ran was:

UPDATE wp_posts SET comment_status = "closed" WHERE post_type = 'attachment' AND comment_status = 'open';

The cool part was that it ran really quick since it was directly connecting to the database. The even better part was that I didn’t have to create a plugin for that though I think I may have to at one point down the line if I forget to change that setting when I upload another image.

I don’t know.

Creating a plugin may just be quicker down the line too. I just don’t want to do the maintaining thing I guess.

On learning languages

The other day I wanted to start a new project, experiment thing to to learn how something worked. I got totally distracted and forgot what I wanted to work on. This seems to happen more and more lately too since there are so many things I really want to learn. I get so distracted with reading about those things that I forget to actually even start the thing.

I did finally start the one thing I did say I wanted to start though and that is to learn a new programming language. For the last 3 months I’ve wanted to dive into something new. A lot of that being because I actually like to know how things works and communicate. That was one of the bigger reasons I wanted to learn PHP and JavaScript.

The other day I jotted down on a piece of paper what I wanted to learn and because the way my brain decided to work the next day I wound up looking up random NodeJS things and that wasn’t even what I wanted to look up. It was in fact the Go language.

I began a course on it and what is super nice is that I am glad I did. There are somethings that I felt very comfortable with and some which were new to me. This was a great feeling. I do miss that.

The part that really caught my attention the most was I had already completed two courses on the site. One was SQL and the other being React. To be honest I forgot I even took the React course so that made me chuckle a little bit.

I think the reason I really liked it was because I do see a lot of the similarities between all the other languages I’ve wanted to learn and have learned.

I was able to get through at least half way done with the course today so that was a good thing. I’ll have to get back to it throughout the week and hopefully do more down the line too.