I’m working on a massive WordPress migration project and after we defined taxonomies they needed to be changed or updated. I tried doing this with SQL but that turned into an Inner Join nightmare due to how taxonomies are related to posts in the database. This script also comes in handy if you want to run mass updates to add all posts to a new category. When you are dealing with thousands of pages doing this manually in the WordPress admin becomes tedious.
So, you can drop these handy little scripts in your theme’s functions.php file for one time updates. These work for posts, pages, custom post types along with categories, tags, and custom taxonomies.
Apply Category To All Posts
Swap All Pages From One Custom Taxonomy Category To Another
This is one of the main reasons I wrote this script. We had hundreds of miss-classified pages in our custom taxonomy and I wanted to swap everything categorized as “News Releases” to another category called “Featured”. As mentioned above
Hopefully this saves you some time. Let me know in the comments if you have any questions.
If you have already defined your custom taxonomy in another plugin and want to use it in a custom post type that you might register in a second plugin, you’ll need to add something like this in your custom post type definition.
The ‘register_taxonomy_for_object_type($taxonomy, $object_type)‘ function is quite nifty. I’ve also used it to enable the standard Category taxonomy on Pages.
We have an entire post on tips for running WordPress on IIS, but it seems one of the biggest questions that come up in forums is how to get WordPress permalinks on IIS working properly. The easiest way is to drop a web.config file in the root of your WordPress site running on IIS.
Here is the web.config file to setup permalinks properly on IIS.
Wondering how git fits into your WordPress dev workflow? Here’s a great little file to help you get started – WordPress gitignore. Don’t know what a gitignore file is for? Read up on the gitignore file on the git manual.
This version of my .gitignore for WordPress assumes you want to manage your WordPress git repository from the root of the site (there are arguments as to whether or not you really want to do this, but that’s for another post).
Basically it ignores WP core files and any themes and plugins not explicitly marked to not ignore. For example, you don’t want to check in the code for the Yoast SEO plugin… because you aren’t actively working on that code and it’s silly to waste space checking it in (plus it becomes a headache to manage updates from Yoast). But if you have a plugin you wrote specific to your site you can use the WordPress gitignore file to explicitly commit those files to your repository.
The same goes for themes. You don’t want the TwentyFourteen theme in your repository because it’s not code you are working on. However if you have created a TwentyFourteen child theme then you’ll want that included in the repository and you should tell the WordPress gitignore file to include it.
Do you use a different method in your WordPress gitignore file? Let us know how you work in the comments.
Searching for posts or pages in the WordPress admin by default only includes titles and body content. If you want to search by custom fields in the WP Admin Edit Posts / Pages page then you can install this plugin or script.
via Bainternet on WordPress StackExchange
I’ve been testing a massive migration from a proprietary CMS to WordPress (using my WordPress C# client). After about 20 different tests my post IDs in the WordPress MySQL database got out of control. I’d create 3,000 posts in one swoop and turn around and delete them while testing. This made my IDs something like 31,341 after day. This isn’t a huge deal but it’s annoying to me.
Note: If you already have created posts / pages and attached them to categories and then change the post id then they will no longer be related properly.
A quick google search will likely lead you to How to reset AUTO_INCREMENT in MySQL on Stackoverflow. However this won’t work if you are running on the InnoDB engine.
In my case I could just mass delete all the post with a SQL statement. If you have content and run the following commands bad stuff will happen.
I’d only use this if you don’t care about dropping all your posts!
While it’s not ideal (I prefer NGINX), sometimes you do need to run a WordPress site on a Windows Server running IIS. Here are a few common problems and solutions for running WordPress on IIS. I don’t go through a full installation tutorial – the famous 5 minute install should get you rolling same as if you were on another OS.
This post is to address three common issues you’ll run into after you install WordPress on IIS – 1) Permissions, 2) Updates, 3) Permalinks.
Note: These particular instructions & screenshots are from a Windows Server 2013 web server running IIS8. These instructions should work on most IIS sites and Azure VMs however may be in a different spot.
WordPress Permissions on IIS
A common problem after installing WordPress on IIS is file permissions. At first you won’t be able to upload pictures and then you will run into an issue changing the permalink structure or updating the wp-config file inside the dashboard. This due to file permissions and for the website to be able to write updates to itself on the server. This can be a rabbit hole fumbling around on permissions for every directory. While that may be fun for you, here’s a swift and simple way to globally update permissions in a safe manner on your WP site.
- Right click on your WordPress site in IIS “Sites” folder and select “Edit Permissions”
- Click “Security” tab
- Click “Edit” button to Edit Permissions for the site
- Click “Add…” button to add the user you want to grant permissions, in this case “Authenticated Users”
- Grant “Authenticated Users” Modify permissions
TL;DR – Grant “Authenticated Users” Modify permissions on your WordPress site in IIS
WordPress Updates on IIS
Now once you have your fancy WordPress install running on IIS and got your permissions applied so you can update the site … you’ll want to install a theme or plugin or run WordPress updates from inside the WordPress dashboard. Not so fast – you need to make a quick tweak on IIS to get WordPress updates and installs to work from the Dashboard.
- Go to the WordPress site’s Application Pool in IIS
- Right-click on the Application Pool and select “Advanced Settings”
- Scroll down under “Process Model” and select “Identity”. It will be set to “Application Pool Identity” by default and you want to change that
- Click on “Application Pool Identity” and select “Local System” as the Built-in account.
- Save and recycle the app pool
TL;DR – You need to run the WordPress site’s Application Pool under the LocalSystem Identity
WordPress Permalinks on IIS
WordPress makes a great CMS for many reasons and pretty SEO-friendly permalinks are one of the reasons. In the WordPress admin dashboard you can set your own URL permalink structure. This is cool. But it doesn’t work quite right running on IIS. You’ve already solved a couple initial problems you’d likely have tried which grants WordPress permissions to update the .htaccess file. Well guess what – IIS does not care about that file and your permalinks won’t work and you won’t be sure why. Well, now you will be. Anyway, you just need to drop a web.config file in the root of your WordPress site on IIS.
TL;DR – you need to setup a web.config file in the root of your WordPress site on IIS. The gist is available below.
This week Posterous announced it would be shutting it’s doors. This leaves many bloggers (including this one) looking for another solution. I had setup my personal site and a podcast site on Posterous for ease of use and simple publishing. Now, it’s time to move them back into WordPress (where they really should have been all along). This is a good reminder – you should always own your site so this doesn’t happen to you.
We had issues moving some sites over to WordPress today using the importer plugin that’s out there now. So, we forked it, fixed it, tested it – and it works! So give it a try if you are having trouble with the original version of the plugin.
1. Download Our WordPress Importer Plugin
Download, Install, and activate our WordPress Importer Plugin.
2. Enter Your Posterous Info
Then enter your information on the Import Posterous page by going to Tools->Import and selecting “Posterous” from the list.
3. Go Get Coffee
Depending on the amount of posts you have, this could take awhile.
This will finish and let you know when it’s done. Then go to Posts and check it out! Check out brudtkuhl.com – I just ran the import!
When time permits I’ve been working on another WordPress starter theme based on Bootstrap, the super awesome CSS and JS framework originally released by Twitter. I use it on everything so it was natural to convert our base starter theme to use Bootstrap. And of course it’s open source (fork it and make it better – please)
So far it’s got the basics and a couple treats. You can choose to make it fluid layout or standard (this could be better worded inside the theme… perhaps a future issue). It also features facebook comments and a blog page template.
More to come as we get the time. For now we are using it at 48web.com and you can fork it and use it yourself on Github.
On most WordPress themes we develop the Facebook comment platform is used. Some like it because it’s social… Others like it because it’s the best way to keep comment spam out. At 48Web, we’ve made it the default comment system in our WordPress Bootstrap Starter Theme.
When I got down to implementing Facebook comments in our WordPress starter theme I immediately ran into an issue of responsiveness. The code Facebook gives you has a static width. This is good for 80% of the themes and is easy to change. But when you are creating a theme framework/starter theme you never know how someone else will implement the layout. Not to mention a 450px Facebook comments doesn’t look great when the browser is narrowed (like you would see on mobile).
So, here’s how we implemented it to be responsive, and simply grow to its container size.
How to Make Facebook Comments Responsive In WordPress
1. Add rules to your CSS file of choice (see ours)
2. Update comments.php to load Facebook Comments
Here’s a gist with everything you need to implement responsive Facebook comments in WordPress.
tip via http://wordpress.org/support/topic/making-facebook-comments-responsive