Tag: WordPress
-
BASH script to change the Security Keys and SALTs in a wp-config.php file
I wanted to automatically change the Security Keys/SALTS when provisioning a new WordPress site. WordPress.com has a service that spits back random values. (https://api.wordpress.org/secret-key/1.1/salt/). The script below CURLs the values and then modifies a wp-config.php file with the new random values. Don’t remember where I got the pieces of this, but here it is, I…
-
Installing WordPress via shell script(BASH)
We have been using a provisioning script that downloads the latest wordpress zip file, extracts into the right location it and sets up the DB connection. I wanted to take it a step further and eliminate the install.php page. The one that looks like this: So i sat down to figure out how to…
-
Activating and deactivating WordPress plugins from a shell script (BASH)
I needed to update my WordPress site provisioning script to download, install and activate a WordPress plugin. The download is the easy part (I just use wget). But how do I activate the plugin. This is what I cam up with: And to be complete, to deactivate:
-
SQL query to find number of WordPress posts per week
I wanted to know how many posts I have been creating each week. Here is a quick MySQL query to find out: Returns:
-
SQL query to find the number of WordPress posts this year!
I was compiling my year end wrap up (hits, posts, twitter followers), and I realized I did not know how many posts I created this year. I ran the following query again my WordPress database to find out. select post_date,post_title from wp_posts where post_type = ‘post’ AND post_status = ‘publish’ AND post_date like ‘%2011-%’; My…
-
A script to loop through a WordPress database and search for text
We maintain both a WordPress development environment and a production environment. I have written a script that copies a WordPress site to the local machine. In that script I change the GUID (even thought this page says you shouldn’t), siteurl, and home. I change the GUID, because the site has not been publicly accessible, so I…
-
Send WordPress post to Google Plus (Not show Google+ on my WordPress site)
I was surprised that I could not find a plugin that would add a new WordPress post to Google+. I saw plugins that showed my Google+ profile card or added a +1 button to my site, but nothing to send a new post automatically to Google+. I can do this with the Twitter Tools plugin…
-
BASH script to email if WordPress plugins or themes need updating
This one took me all day. But I got it. I wanted to have a script that could look through all WordPress sites and find if there are outdated themes or plugins. All I need to do is slap it into a cron job and I am good to go! Here is the BASH code…
-
php53 included in CentOS 5.6
I wish I read release notes, it would make my life easier. In my previous post, I was worried about CentOS 5.x not having a new enough version of PHP to run the soon to be release WordPress 3.2. Well, RedHat’s 5.6 release notes clearly say: Version 5.3.3 of PHP is now available in Red…
-
“error establishing a database connection” in a previously working WordPress site
My site just crashed!!! I received the oh-so-helpful error “establishing a database connection” when I went to my site. Other sites on the server were fine. The site was working fine, and my config had not changed. The httpd error log showed nothing. Then I found this in the MySQL logs (/var/log/mysqld.log) [ERROR] /usr/libexec/mysqld: Table…
